forked from p34709852/monkey
Common: Catch MarshmallowError instead of Exception
This commit is contained in:
parent
6bb6aa5250
commit
06fc4aaad6
|
@ -4,6 +4,7 @@ from dataclasses import dataclass
|
||||||
from typing import Any, Mapping, MutableMapping, Sequence, Tuple
|
from typing import Any, Mapping, MutableMapping, Sequence, Tuple
|
||||||
|
|
||||||
from marshmallow import Schema, fields, post_load, pre_dump
|
from marshmallow import Schema, fields, post_load, pre_dump
|
||||||
|
from marshmallow.exceptions import MarshmallowError
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
CredentialComponentType,
|
CredentialComponentType,
|
||||||
|
@ -122,7 +123,7 @@ class Credentials:
|
||||||
return Credentials(**deserialized_data)
|
return Credentials(**deserialized_data)
|
||||||
except (InvalidCredentialsError, InvalidCredentialComponentError) as err:
|
except (InvalidCredentialsError, InvalidCredentialComponentError) as err:
|
||||||
raise err
|
raise err
|
||||||
except Exception as err:
|
except MarshmallowError as err:
|
||||||
raise InvalidCredentialsError(str(err))
|
raise InvalidCredentialsError(str(err))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -132,7 +133,7 @@ class Credentials:
|
||||||
return Credentials(**deserialized_data)
|
return Credentials(**deserialized_data)
|
||||||
except (InvalidCredentialsError, InvalidCredentialComponentError) as err:
|
except (InvalidCredentialsError, InvalidCredentialComponentError) as err:
|
||||||
raise err
|
raise err
|
||||||
except Exception as err:
|
except MarshmallowError as err:
|
||||||
raise InvalidCredentialsError(str(err))
|
raise InvalidCredentialsError(str(err))
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue