Revize 2166bb21
Přidáno uživatelem Stanislav Král před téměř 4 roky(ů)
src/controllers/certificates_controller.py | ||
---|---|---|
66 | 66 |
"It may be caused by wrong format of extensions."} |
67 | 67 |
|
68 | 68 |
E_UNHANDLED_CRYPTOGRAPHY_ERROR = {"success": False, "data": "An unknown error has happened in the cryptography library."} |
69 |
E_UNHANDLED_DATABASE_ERROR = {"success": False, "data": "An unknown database error has happened."} |
|
69 | 70 |
|
70 | 71 |
|
71 | 72 |
class CertController: |
... | ... | |
775 | 776 |
def handle_cryptography_error(e): |
776 | 777 |
Logger.error(f"An unhandled CryptographyException has been raised: {str(e)}") |
777 | 778 |
return E_UNHANDLED_CRYPTOGRAPHY_ERROR, C_INTERNAL_SERVER_ERROR |
779 |
|
|
780 |
@staticmethod |
|
781 |
def handle_database_error(e): |
|
782 |
Logger.error(f"An unhandled DatabaseException has been raised: {str(e)}") |
|
783 |
return E_UNHANDLED_DATABASE_ERROR, C_INTERNAL_SERVER_ERROR |
Také k dispozici: Unified diff
Added a global error handler for DatabaseException errors.
Covered the added global DatabaseException error handler in a test.