Skip to content

Commit

Permalink
Invalid value error 🦜
Browse files Browse the repository at this point in the history
  • Loading branch information
Sibyx committed Jan 7, 2020
1 parent afb78fc commit b6e7eeb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## 0.5.7 : 07.01.2020

- **Fix**: Introduced generic `Invalid value` error message, if there is `AttributeError`, `TypeError`, `ValueError`

## 0.5.6 : 01.01.2020

- **Fix**: Fixing issue from version `0.5.5` but this time for real
Expand Down
3 changes: 3 additions & 0 deletions django_request_formatter/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import msgpack
from django.core.exceptions import ValidationError, NON_FIELD_ERRORS
from django.forms import MediaDefiningClass, Field
from django.utils.translation import gettext

from django_request_formatter.exceptions import RequestValidationError

Expand Down Expand Up @@ -147,6 +148,8 @@ def full_clean(self):
self.cleaned_data[key] = getattr(self, f"clean_{key}")()
except (ValidationError, RequestValidationError) as e:
self.add_error(key, e)
except (AttributeError, TypeError, ValueError):
self.add_error(key, gettext("Invalid value"))

try:
cleaned_data = self.clean()
Expand Down
2 changes: 1 addition & 1 deletion django_request_formatter/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.5.6'
__version__ = '0.5.7'

0 comments on commit b6e7eeb

Please sign in to comment.