exceptions: Guard validation error conversion with message_dict.

Iterating over ValidatorError does not necessarily return a tuple. This
uses the `message_dict` property on `ValidationError` instead to make
sure that we always get a `dict` (it otherwise raises an `AttributeError`
when the `dict` is not available).

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
Zixuan James Li
2022-07-22 17:52:07 -04:00
committed by Tim Abbott
parent 43106fb6ce
commit 3104a7ea94

View File

@@ -471,4 +471,4 @@ class ValidationFailureError(JsonableError):
def __init__(self, error: ValidationError) -> None:
super().__init__(error.messages[0])
self.errors = dict(error)
self.errors = error.message_dict