Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error reporting on unknown errors #749

Open
Er1cG1ft opened this issue Jun 19, 2020 · 2 comments
Open

Better error reporting on unknown errors #749

Er1cG1ft opened this issue Jun 19, 2020 · 2 comments

Comments

@Er1cG1ft
Copy link

I'm using pyoidc to interact with a backend that doesn't perfectly follow the OIDC spec, and when calling parse_request_response on an invalid token response, I sometimes get an error code that isn't one of the valid TokenErrorResponse errors. The actual error code is buried in the logs, and all the client sees is the 'Missing or fault response' errror. Is it possible to improve the error handling in the parse_response method to raise the actual error code and message to the client? More specifically, improving the verify method of a response to throw an error notifying the user that the error code is not supported by the relevant response class?

                    try:
                        resp = errmsg().deserialize(info, sformat)
                        resp.verify()
                        break
                    except Exception:
                        resp = None

Currently, resp.verify() throws an error that is caught, and the response is wiped, resulting in the generic Missing or fault response message from here:

        if not resp:
            logger.error("Missing or faulty response")
            raise ResponseError("Missing or faulty response")
@tpazderka
Copy link
Collaborator

I am not sure I completely follow...

Would you like to add extra logging of the reason why the message failed OR would you like to add extra info to the content of ResponseError?

@Er1cG1ft
Copy link
Author

The latter; the reason why the message failed is in the logs, but I would like that reason more easily visible to the client. Something like:

raise ResponseError("Missing or faulty response: " + resp)

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

No branches or pull requests

2 participants