Skip to content

Expose error variant as ServerError field #8

@Yamakaky

Description

@Yamakaky

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 err

A 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions