Skip to content

Ability to opt-out from DetailDictMixin on error processing #915

Open
@sshishov

Description

@sshishov

Hi, we are using this library and at the same time we are using drf-standardized-errors.

With current implementation of errors (having DetailDictMixin mixin) we are getting the following errors:

{
    "type": "client_error",
    "errors": [
        {
            "code": "token_not_valid",
            "detail": "Given token not valid for any token type",
            "attr": "detail"
        },
        {
            "code": "token_not_valid",
            "detail": "token_not_valid",
            "attr": "code"
        },
        {
            "code": "token_not_valid",
            "detail": "AccessToken",
            "attr": "messages.0.token_class"
        },
        {
            "code": "token_not_valid",
            "detail": "access",
            "attr": "messages.0.token_type"
        },
        {
            "code": "token_not_valid",
            "detail": "Token is invalid or expired",
            "attr": "messages.0.message"
        }
    ]
}

It is completely off and to override this behavior we have to create custom errors for everything.

Would you mind to add the ability to OPT-OUT from "formatting DRF errors"? We can do it by adding some setting and based on this setting inside mixing we either pre-process the code or run super without pre-processing.

Very often different orgs using their own proprietary format and we should not force them to do it.

Best regards,
Sergei

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