You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@annavik discovered that the field validators for GET parameters and other user-passed values are returning 500 errors instead of 400's. Also the error message data does not specify which field has a validation issue. This is because we are using Django's form field validators instead of the Django Rest Framework validators (from its serializers). Two examples that fixe this issue were introduced in #643, and this pattern needs to be applied to other cases where we are importing from django.forms (IntegerField, DateField, etc.). In general, the solution is to always make a serializer, and then call is_valid() on the serializer, which will raise a 400 error with a detailed & structured message about each field.
Also in the case that a 500 is still returned from the backend, it is possible that the response has some error information. We frontend should be able to display that as well.
The text was updated successfully, but these errors were encountered:
When we get to this this, let's also make sure that we show any backend errors in context (below affected field) if possible. I mean frontend side. Example:
Also I wonder about the Swedish messages that are returned from backend. I like the idea, but until rest of the app supports translations, I think mixing languages might look a bit strange. Also my browser has English language preference, so I'm a bit surprised to get messages in Swedish, is it because of my location?
@annavik discovered that the field validators for GET parameters and other user-passed values are returning 500 errors instead of 400's. Also the error message data does not specify which field has a validation issue. This is because we are using Django's form field validators instead of the Django Rest Framework validators (from its serializers). Two examples that fixe this issue were introduced in #643, and this pattern needs to be applied to other cases where we are importing from
django.forms
(IntegerField, DateField, etc.). In general, the solution is to always make a serializer, and then callis_valid()
on the serializer, which will raise a 400 error with a detailed & structured message about each field.Also in the case that a 500 is still returned from the backend, it is possible that the response has some error information. We frontend should be able to display that as well.
The text was updated successfully, but these errors were encountered: