-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
We are converting sns-api errors to custom ones. Since all errors are bundled in ServerError, this makes it difficult to differentiate error cases. For example:
except ServerError as err:
msg = SSLClient.SSL_SERVERD_MSG
if str(err) in msg[SSLClient.SSL_SERVERD_AUTH_ERROR]:
raise errors.DeviceAuthFailed(
f"authentication error from Stormshield: {err}"
) from errA quick fix would be to add an error_code field to ServerError set to SSLClient.SSL_SERVERD_*. A better long term solution would be to have a proper error classes hierarchy, for example:
SNSError
-> AuthenticationError
-> WrongCreds
-> WrongCert
-> ConfigurationError
-> MissingCABundle
-> ConnectionError
-> ServerError
-> PendingUploadError
...
Metadata
Metadata
Assignees
Labels
No labels