Common: Catch MarshmallowError instead of Exception

This commit is contained in:
Mike Salvatore 2022-07-07 08:47:41 -04:00
parent 6bb6aa5250
commit 06fc4aaad6
1 changed files with 3 additions and 2 deletions

View File

@ -4,6 +4,7 @@ from dataclasses import dataclass
from typing import Any, Mapping, MutableMapping, Sequence, Tuple
from marshmallow import Schema, fields, post_load, pre_dump
from marshmallow.exceptions import MarshmallowError
from . import (
CredentialComponentType,
@ -122,7 +123,7 @@ class Credentials:
return Credentials(**deserialized_data)
except (InvalidCredentialsError, InvalidCredentialComponentError) as err:
raise err
except Exception as err:
except MarshmallowError as err:
raise InvalidCredentialsError(str(err))
@staticmethod
@ -132,7 +133,7 @@ class Credentials:
return Credentials(**deserialized_data)
except (InvalidCredentialsError, InvalidCredentialComponentError) as err:
raise err
except Exception as err:
except MarshmallowError as err:
raise InvalidCredentialsError(str(err))
@staticmethod