You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I came across inconsistent behaviour with the reason in the HttpError exception. It seems to depend on the pipe_to function argument being present or not. If we have a pipe_to argument, the non-200 response doesn't have the error reason field populated.
Why is it important?
According to google docs there are at least 8 possible reasons for getting a 403 response. The recommended approach to dealing with 403s depends on the returned reason in the non-200 response.
In this scenario, when calling the client directly, the 403 response will cause a HttpError to be thrown with a reason:
Forbidden
Content:
{'code': 403,
'errors': [{'domain': 'global',
'message': 'This file is too large to be exported.',
'reason': 'exportSizeLimitExceeded'}],
'message': 'This file is too large to be exported.'}
Request URL:
https://www.googleapis.com/drive/v3/files/...
But when using a pipe_to argument, the HttpError won't contain the error reason.
I suppose it's not expected behaviour. The reason in the error response should (always?) be populated, meaning we can access it e.g. via e.res.reason in case we encounter HttpError e.
I'm happy to contribute with a PR if you feel like this issue should be addressed.
Also, thank you for building and maintaining this library. 🥇
The text was updated successfully, but these errors were encountered:
Hi, I came across inconsistent behaviour with the
reason
in theHttpError
exception. It seems to depend on thepipe_to
function argument being present or not. If we have apipe_to
argument, the non-200 response doesn't have the error reason field populated.Why is it important?
According to google docs there are at least 8 possible reasons for getting a 403 response. The recommended approach to dealing with 403s depends on the returned reason in the non-200 response.
Code example to reproduce
In this scenario, when calling the client directly, the 403 response will cause a
HttpError
to be thrown with a reason:But when using a
pipe_to
argument, theHttpError
won't contain the error reason.Thrown error:
Next steps
I suppose it's not expected behaviour. The
reason
in the error response should (always?) be populated, meaning we can access it e.g. viae.res.reason
in case we encounterHttpError e
.I'm happy to contribute with a PR if you feel like this issue should be addressed.
Also, thank you for building and maintaining this library. 🥇
The text was updated successfully, but these errors were encountered: