Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Using EXCEPTION_HANDLER is not compatible with multiple DRF configurations #214

Closed
@riklaunim

Description

@riklaunim

To get proper error responses EXCEPTION_HANDLER must be set as mentioned in #188 however EXCEPTION_HANDLER is the only setting that can't be set on a class, thus preventing multi-configuration projects - I have vanilla-DRF and JSONApi views in the project.

The source of the problem is in https://github.com/tomchristie/django-rest-framework/blob/master/rest_framework/views.py#L413 where exception_handler = self.settings.EXCEPTION_HANDLER

I asked on DRF irc channel about it and it was suggested that the renderer itself could handle that error response formatting. Can't say how that would fit, but it's either that or slight modification to the base view class in DRF so that it's easier to change the exception handler (instead of hacking with deepcopy of self.settings or copy-pasting the whole method).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions