def handle_exception(self, exc):
if isinstance(<EOL>exc, (rest_exceptions.NotAuthenticated,<EOL>rest_exceptions.AuthenticationFailed)) and self.HANDLE_UNAUTHENTICATED:<EOL><INDENT>return HttpResponseRedirect('<STR_LIT>'.format(<EOL>reverse('<STR_LIT>'),<EOL>self.request.get_full_path()))<EOL><DEDENT>if isinstance(exc, Http404):<EOL><INDENT>raise Http404()<EOL><DEDENT>if isinstance(exc, rest_exceptions.PermissionDenied):<EOL><INDENT>raise django_exceptions.PermissionDenied()<EOL><DEDENT>return super().handle_exception(exc)<EOL>
Use custom exception handler for errors.