Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
handleResponse(status, headers, payload, requestData) {
if (this.isSuccess(status, headers, payload)) {
return payload;
} else if (this.isInvalid(status, headers, payload)) {
return new InvalidError(payload.errors);
}
let errors = this.normalizeErrorResponse(status, headers, payload);
let detailedMessage = this.generatedDetailedMessage(status, headers, payload, requestData);
switch (status) {
case 401:
return new UnauthorizedError(errors, detailedMessage);
case 403:
return new ForbiddenError(errors, detailedMessage);
case 404:
return new NotFoundError(errors, detailedMessage);
case 409:
return new ConflictError(errors, detailedMessage);
default:
if (status >= 500) {