mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 14:05:44 +01:00
renaming
This commit is contained in:
@@ -16,20 +16,20 @@ function handleStatusCode(response: Response) {
|
|||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
switch (response.status) {
|
switch (response.status) {
|
||||||
case 401:
|
case 401:
|
||||||
return throwErrorWithMessage(response, UNAUTHORIZED_ERROR);
|
return throwError(response, UNAUTHORIZED_ERROR);
|
||||||
case 404:
|
case 404:
|
||||||
return throwErrorWithMessage(response, NOT_FOUND_ERROR);
|
return throwError(response, NOT_FOUND_ERROR);
|
||||||
case 409:
|
case 409:
|
||||||
return throwErrorWithMessage(response, CONFLICT_ERROR);
|
return throwError(response, CONFLICT_ERROR);
|
||||||
default:
|
default:
|
||||||
return throwErrorWithMessage(response, new Error("server returned status code " + response.status));
|
return throwError(response, new Error("server returned status code " + response.status));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
||||||
function throwErrorWithMessage(response: Response, err: Error) {
|
function throwError(response: Response, err: Error) {
|
||||||
return response.json().then(
|
return response.json().then(
|
||||||
json => {
|
json => {
|
||||||
throw Error(json.message);
|
throw Error(json.message);
|
||||||
|
|||||||
Reference in New Issue
Block a user