Improve validator error handling

This commit is contained in:
Cristi Vîjdea
2018-01-11 21:19:42 +01:00
parent c225f66fb7
commit 57d77cc48a
6 changed files with 23 additions and 15 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ class SwaggerExceptionMiddleware(object):
def process_exception(self, request, exception):
if isinstance(exception, SwaggerValidationError):
err = {'errors': {exception.validator_name: str(exception)}}
err = {'errors': exception.errors, 'message': str(exception)}
codec = exception.source_codec
if isinstance(codec, _OpenAPICodec):
err = codec.encode_error(err)