gold eggs backend
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
This commit is contained in:
17
core/http/serializers/generics.py
Normal file
17
core/http/serializers/generics.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from rest_framework import exceptions
|
||||
from rest_framework import serializers
|
||||
|
||||
|
||||
from core import enums
|
||||
from core.utils import exception
|
||||
|
||||
|
||||
class GenericSerializer(serializers.Serializer):
|
||||
def to_internal_value(self, data):
|
||||
try:
|
||||
return super().to_internal_value(data)
|
||||
except exceptions.ValidationError as e:
|
||||
key, value = next(iter(e.detail.items()))
|
||||
exception.ResponseException(
|
||||
value[0], error_code=enums.Codes.INVALID_PARAMETER_VALUE
|
||||
)
|
||||
Reference in New Issue
Block a user