question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

feat: unchecked exceptions for start and stop functions

See original GitHub issue

Hi, thanks for writing this library. I tried to use it because I needed this functionality, but had to give up and look at alternatives. But I can provide you some feedback:

  1. in MockOAuth2Server, both start and shutdown throw checked exceptions. This is not a problem in Kotlin, but it is a major PITA in Java. having to wrap in try/catch all their use is not so great when writing tests

  2. no JavaDocs on any of the methods in MockOAuth2Server, which unfortunately makes this library nearly unusable, unless one study its source code

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
ybelMekkcommented, Jun 1, 2022

Hello again.

Good and good. yes it makes sense. But you can get the port by server.port()?

Could put the documentation issue in it own issue, and we call this something else 😃

1reaction
arcuri82commented, May 31, 2022

Hi,

1 yes, just having alternative start/stop methods that do not throw checked exceptions (eg by wrapping them in RuntimeException) would be enough. Not sure though which names would be best for these new functions. Adding to this, would be also be good to have a method to start the mocked server on an ephemeral port, and then return the actual bound port. Right now could use start(0), but then it is unclear how to read back the bound port

2 sorry to say, but can’t really write documentation for an API I haven’t written… unless I study in details all the source code. Furthermore, it is also a matter of making sure that the generated jar for the JavaDocs gets created and uploaded on Maven Central (I have done it in Maven, but not much experience with Gradle…)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unchecked Exceptions — The Controversy
This Java tutorial describes exceptions, basic input/output, concurrency, regular expressions, and the platform environment.
Read more >
How to Handle Checked & Unchecked Exceptions in Java
A checked exception must be handled either by re-throwing or with a try catch block, a runtime isn't required to be handled. An...
Read more >
Checked and Unchecked Exceptions in Java - Baeldung
In general, checked exceptions represent errors outside the control of the program. For example, the constructor of FileInputStream throws ...
Read more >
Implement Custom Exceptions in Java: Why, When and How
Learn 4 best practices for custom exceptions in Java. Understand when and how to use them in your application.
Read more >
Checked vs Unchecked Exceptions in Java - GeeksforGeeks
Exception is an unwanted or unexpected event, which occurs during the execution of a program, i.e. at run time, that disrupts the normal ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found