Description
restful apis usually return response of 40x
with a body explaining the error reason, and sometimes these error response even can be what we want to get in a 20x
response.
and in Shields, all these 40x
responses are treated as unusable exceptions and in foo.service.js
it's hard to handle these responses.
For example to solve #4811 , I plan to get the SHA of the file and get the size through git/blobs/:sha
endpoint (it supports blobs up to 100 megabytes in size). However, I find that the response code from contents/
endpoint of those files larger than 1MB are 403
so they can't be handled in github-size.service.js
.
Why not change errorMessages
from {[prop: number]: string}
to {[prop: number]: (body: string) => string}
so many error message can be better handled ?