Feature request: flush buffer on uncaught error - class method decorator #3635
Labels
completed
This item is complete and has been merged/shipped
feature-request
This item refers to a feature request for an existing or new utility
logger
This item relates to the Logger Utility
Use case
In #3617 we have implemented a mechanism to buffer logs. The next step in the implementation is to allow customers to flush the buffer whenever there's an uncaught error thrown in the handler scope. This will be an opt-in feature and this item focuses on implementing this behavior for the class method decorator.
Solution/User Experience
As mentioned, this will be an opt-in feature. Customers will be able to enable it by passing a new option to the decorator called
flushBufferOnUncaughtError
:In terms of implementation, we'll have to refactor the current decorator implementation here.
Contrary to the ones in #3633, the changes for the decorator should be fairly straightforward. Currently we have a
try/catch
block in which we are actually not handling thecatch
block, but only thefinally
one:we should refactor this to something like:
In order to add the new config option to the decorator, you'll have to add it to the corresponding type here. Depending on whether you work on this or #3633 first, you might already have the type available.
Other than that, we should make sure the new code is covered by unit tests and the new type in the options is documented with comments.
Alternative solutions
Acknowledgment
Future readers
Please react with 👍 and your use case to help us understand customer demand.
The text was updated successfully, but these errors were encountered: