Skip to content

JSONError inheriting from HTTPError causes named error with details #586

Description

@fmigneault

Somewhat like #275, but since it dates from 2015, things changed a lot in the code.

Because cornice.renderer.JSONError inherits from pyramid.httpexceptions.HTTPError, its __str__ implementation looks for the detail attribute. A simple logging call such as logger.info("exception: {!s}", err) is enough to cause this exception to crash.

The HTTPException itself the following:

    def __str__(self):
        return str(self.detail) if self.detail else self.explanation

So either the JSON body could be set to detail and let it represent it as plain string, or define detail/explanation accordingly with some more explicit message.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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