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.

Correct placement for exception catching

See original GitHub issue

We are experiencing a bit of trouble when using the consumer in particular. Mainly because exceptions doesn’t seem to bubble-up.

Say we create a Consumer from a subscription that doesn’t exist (could be anything that causes FaulAction.Rethrow or ThrowException). No exceptions will present themselves.

Where, or rather when are they actually thrown? The only feasibly hook ive found (on the consumer) is to call IsFinalState or use a Monitor (although throwing in the monitor also does not bubble-up anywhere), but if we are already awaiting messages or receiving, checking final state is not feasible (unless implementing fast cancellationtoken cancels and retrying or something).

So my questions are;

  1. Where are we expected to catch exceptions? (Monitor, ExceptionHandler, usage of consumer?)
  2. What is the proper pattern for handling faulted state? (re-create the consumer/producer?)

In my tests neither Receieve nor Messages throw, like the (somewhat) idiomatic equivalent on the producer side (Send).

No exceptions seems to bubble up for the Consumer.

Issue Analytics

  • State:closed
  • Created 8 months ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
blankensteinercommented, Jan 31, 2023

Version 2.10.0 (just released) fixes this 😃

1reaction
blankensteinercommented, Jan 27, 2023

Thanks, I will look into it 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

5 Rules about Catching Exceptions in Java | by Madhu Cynix
However, keep in mind this rule: if the exceptions have parent-child relationship, the catch blocks must be sorted by the most specific exceptions...
Read more >
Exception Handling in Java with Examples | 2023
Note – If we put code of outer try before inner try, then if an exception occurred, it will ignore the entire inner...
Read more >
Exception Handling - placement practice test
Exception Handling - placement practice test ... Compiler will check for appropriate catch handler of outer try block d. None of these
Read more >
Best Practices to Handle Exceptions in Java
In general, you should catch exceptions at the level where you can take appropriate action to recover from the error. 3. Log and...
Read more >
Exception Handling in C++
catch : Represents a block of code that is executed when a particular exception is thrown. throw: Used to throw an exception. Also...
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