app.exception_handler does not work when used in separate file #1191
-
|
Hi, I am using APIGatewayRestResolver and I'm having trouble working with @app.exception_handler. When I have APIGatewayRestResolver object and @app.exception_handler decorator in same file then it works but if I create a separate file for exceptions(exceptions.py) and do the import of APIGatewayRestResolver then it doesn't work.
I don't have much expertise on how decorator works so any help here would be appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
@arunbhati in your example nothing is referencing You can verify that So maybe either reference the |
Beta Was this translation helpful? Give feedback.
@arunbhati in your example nothing is referencing
exceptions.pyso it would not call either of the@app.exception_handleror@app.not_founddecorators.You can verify that
exceptions.pyis not being referenced by adding aprintstatement.So maybe either reference the
exceptions.pyas an import elsewhere or load it via__init__.py, or move the logic in__init__.py__