From 55e135436d6c145da64095ca9d74165172a456b0 Mon Sep 17 00:00:00 2001 From: Radoslav Georgiev Date: Sun, 19 Jan 2020 14:52:51 +0200 Subject: [PATCH] Rename `ExceptionHandlerMixin` to `ApiErrorsMixin` --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fe3fec6..78d932b 100644 --- a/README.md +++ b/README.md @@ -593,7 +593,7 @@ def get_error_message(exc): You can move this code to a mixin and use it in every API to prevent code duplication. -We call this `ExceptionHandlerMixin`. Here's a sample implementation from one of our projects: +We call this `ApiErrorsMixin`. Here's a sample implementation from one of our projects: ```python from rest_framework import exceptions as rest_exceptions @@ -603,7 +603,7 @@ from django.core.exceptions import ValidationError from project.common.utils import get_error_message -class ExceptionHandlerMixin: +class ApiErrorsMixin: """ Mixin that transforms Django and Python exceptions into rest_framework ones. Without the mixin, they return 500 status code which is not desired. @@ -629,7 +629,7 @@ Having this mixin in mind, our API can be written like that: ```python class CourseCreateApi( SomeAuthenticationMixin, - ExceptionHandlerMixin, + ApiErrorsMixin, APIView ): class InputSerializer(serializers.Serializer):