Revize d55b3aff
Přidáno uživatelem Stanislav Král před téměř 4 roky(ů)
src/controllers/certificates_controller.py | ||
---|---|---|
67 | 67 |
|
68 | 68 |
E_UNHANDLED_CRYPTOGRAPHY_ERROR = {"success": False, "data": "An unknown error has happened in the cryptography library."} |
69 | 69 |
E_UNHANDLED_DATABASE_ERROR = {"success": False, "data": "An unknown database error has happened."} |
70 |
E_UNHANDLED_ERROR = {"success": False, "data": "An unknown error has happened."} |
|
70 | 71 |
|
71 | 72 |
|
72 | 73 |
class CertController: |
... | ... | |
781 | 782 |
def handle_database_error(e): |
782 | 783 |
Logger.error(f"An unhandled DatabaseException has been raised: {str(e)}") |
783 | 784 |
return E_UNHANDLED_DATABASE_ERROR, C_INTERNAL_SERVER_ERROR |
785 |
|
|
786 |
@staticmethod |
|
787 |
def handle_generic_exception(e): |
|
788 |
Logger.error(f"An unknown Exception ({type(e)}) has been raised: {str(e)}") |
|
789 |
return E_UNHANDLED_ERROR, C_INTERNAL_SERVER_ERROR |
Také k dispozici: Unified diff
Added a global error handler for generic exceptions.
Covered the added global exception error handler in a test.