status code is not provided when InvalidResponseError is obtained
AlvaroVega opened this issue · 3 comments
Cloned from conwetlab#54
status code is not provided when InvalidResponseError is obtained
InvalidResponseError could happens for example when PEP responses 401
Not sure if is really a bug or maybe just something that could be improved.
Others errors like InvalidRequestError are providing status code:
Hi @AlvaroVega!
Thanks for reporting this.
I think adding the status code to the InvalidRequestError exception would be a great addition as usually this error is raised as the response status code is not one of the expected ones. In addition, we are going to provide also the body of the response. Both details should provide a good way to check what the problem is.
That said, I was thinking about the 401 error code, and I think that error response should not be managed with the InvalidRequestError. So we are working on adding an UnauthorizedError exception for those cases as well as an ForbiddenError exception for the 403 status code. What do you think?
Absolutely, 401 and UnauthorizedError and 403 with ForbiddenError .
Thanks!