Skip to content

Commit

Permalink
Pass Invalid value as ValidationError
Browse files Browse the repository at this point in the history
  • Loading branch information
Sibyx committed Jan 7, 2020
1 parent b6e7eeb commit 640ccb5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
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.8 : 07.01.2020

- **Fix**: Pass `Invalid value` as `ValidationError` not as a `string`

## 0.5.7 : 07.01.2020

- **Fix**: Introduced generic `Invalid value` error message, if there is `AttributeError`, `TypeError`, `ValueError`
Expand Down
4 changes: 2 additions & 2 deletions django_request_formatter/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +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.utils.translation import gettext as _

from django_request_formatter.exceptions import RequestValidationError

Expand Down Expand Up @@ -149,7 +149,7 @@ def full_clean(self):
except (ValidationError, RequestValidationError) as e:
self.add_error(key, e)
except (AttributeError, TypeError, ValueError):
self.add_error(key, gettext("Invalid value"))
self.add_error(key, ValidationError(_("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.7'
__version__ = '0.5.8'

0 comments on commit 640ccb5

Please sign in to comment.