azure-functions-python-worker icon indicating copy to clipboard operation
azure-functions-python-worker copied to clipboard

Add hook for exception handling

Open tanyunshi opened this issue 1 year ago • 6 comments

Binding Type

No response

Expected Behavior

I am looking for a place to centralize the exception handling. For example, to log all exceptions with the invocation id and a correlation ID.

As I cannot use a base class in azure functions (as they are functions :) ), I suppose that I can use the extensions, where I can implement behaviors for an event.

I wished I could use post_invocation_app_level but then I realize that this method will not be called if the function fails

It would be useful to have a method like "exception_invocation_app_level" for the application level extensions. The method is called once an exception is raised in the function execution. The function context, invocation args and the raised exception are passed to the methode.

Relevant sample code snipped

No response

Additional Information

No response

tanyunshi avatar Jul 12 '24 15:07 tanyunshi

thanks for reporting will discuss and update you.Thanks

bhagyshricompany avatar Jul 16 '24 11:07 bhagyshricompany

I have a similar requirement. In my case, I will be implementing Sentry, so I want a way to be able to handle all the exceptions. All my attempts have failed. Is there an existing way of hooking into this? I've also used Sentry's serverless decorator, but even though it's wrapping a function that gets called, the wrapped function just doesn't throw an error as it's apparently caught by Azure.

rokcarl avatar Jul 19 '24 10:07 rokcarl

@gavin-aguiar please confirm.Thanks

bhagyshricompany avatar Jul 30 '24 13:07 bhagyshricompany

Hi all, we are working on a feature to provide this functionality. We don't have an ETA as of now but will keep this issue updated once the feature is released.

gavin-aguiar avatar Jul 30 '24 17:07 gavin-aguiar

Hi all, we are working on a feature to provide this functionality. We don't have an ETA as of now but will keep this issue updated once the feature is released.

Really appreciate it ! Pls keep us informed. :)

tanyunshi avatar Jul 31 '24 17:07 tanyunshi

Hello, Do you have any update for this ? Thank you

tanyunshi avatar Nov 08 '24 17:11 tanyunshi