Skip to content

Commit 95e6bfe

Browse files
author
Markus Törnqvist
committed
Show form error what was caught
1 parent 2808f73 commit 95e6bfe

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

json_field/forms.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ def clean(self, value):
2121
}
2222
try:
2323
value = json.dumps(eval(value, json_globals, {}), **self.encoder_kwargs)
24-
except Exception: # eval can throw many different errors
25-
raise util.ValidationError(self.help_text) # throw the original error?
24+
except Exception, e: # eval can throw many different errors
25+
raise util.ValidationError('%s (Caught "%s")' % (self.help_text, e))
2626
try:
2727
json.loads(value, **self.decoder_kwargs)
28-
except ValueError:
29-
raise util.ValidationError(self.help_text)
28+
except ValueError, e:
29+
raise util.ValidationError('%s (Caught "%s")' % (self.help_text, e))
3030
return value

0 commit comments

Comments
 (0)