Fix AttributeError
Exceptions aren't guaranteed to have a 'message' attribute. It does have 'args', but str(ex) is probably more useful as it's likely to include the exception type.
This commit is contained in:
parent
9c3667b51f
commit
72f440f509
@ -181,7 +181,7 @@ class JSONRequired(validators.DataRequired):
|
||||
try:
|
||||
json.loads(field.data)
|
||||
except ValueError as ex:
|
||||
message = self.message or ex.message
|
||||
message = self.message or str(ex)
|
||||
|
||||
field.errors[:] = []
|
||||
raise validators.StopValidation(message)
|
||||
|
Loading…
x
Reference in New Issue
Block a user