Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't print stack trace during InterruptedException. #98

Open
cmhulbert opened this issue Nov 29, 2023 · 1 comment
Open

Don't print stack trace during InterruptedException. #98

cmhulbert opened this issue Nov 29, 2023 · 1 comment

Comments

@cmhulbert
Copy link

I have a situation where I expect the user may modify the image I am running ConnectedComponents on, in which case I interrupt the existing attempt and retrigger with the new image. It works fine, but always prints the stack trace from the interrupted exception. I'm not sure how best to handle here, but given this is a blocking and potentially slow task, it may be best to just let the method throws InterruptedException? Or is there a better way to achieve this?

@tpietzsch
Copy link
Member

Yes, re-throwing the exception is definitely better than printStackTrace().

In the same method, also ExecutionException is caught and printed. It would be good, to also fix that. Do we know what we potentially expect to be nested under the ExecutionException? Could also be InterruptedException? Anything else? Maybe we can handle and re-throw expected standard causes, and wrap the rest into RuntimeException.

The exceptions will bubble up to the public static labelAllConnectedComponents methods and should also be declared there.

cmhulbert added a commit to saalfeldlab/paintera that referenced this issue Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants