chore(fix): fixes sync response not correctly identifying all errors (#2346)

This commit is contained in:
Mo
2023-07-05 11:28:45 -05:00
committed by GitHub
parent 2a050fd966
commit 0ab6b5c6fe
19 changed files with 81 additions and 49 deletions

View File

@@ -315,12 +315,14 @@ export class HttpService implements HttpServiceInterface {
console.error(error)
}
if (httpStatus >= HttpStatusCode.Success && httpStatus < HttpStatusCode.InternalServerError) {
if (
httpStatus === HttpStatusCode.Forbidden &&
response.data &&
(response as HttpErrorResponse).data.error !== undefined
) {
;(response as HttpErrorResponse).data.error.message = ErrorMessage.RateLimited
if (httpStatus === HttpStatusCode.Forbidden && isErrorResponse(response)) {
if (!response.data.error) {
response.data.error = {
message: ErrorMessage.RateLimited,
}
} else {
response.data.error.message = ErrorMessage.RateLimited
}
}
resolve(response)
} else {