Some checks failed
Build and Push to Docker Hub / build-test-push (push) Failing after 1m55s
18 lines
519 B
Python
18 lines
519 B
Python
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
|
|
)
|