improvement: clear error if Git Gateway settings 404
This commit is contained in:
parent
4f3116de4d
commit
424a49e36c
@ -90,7 +90,20 @@ export default class GitGateway {
|
||||
{
|
||||
headers: { Authorization: `Bearer ${token}` },
|
||||
},
|
||||
).then(res => res.json());
|
||||
).then(async res => {
|
||||
const contentType = res.headers.get('Content-Type');
|
||||
if (contentType !== 'application/json' && contentType !== 'text/json') {
|
||||
throw new APIError(`Your Git Gateway backend is not returning valid settings. Please make sure it is enabled.`, res.status, 'Git Gateway');
|
||||
}
|
||||
|
||||
const body = await res.json();
|
||||
|
||||
if (!res.ok) {
|
||||
throw new APIError(`Git Gateway Error: ${(body.message ? body.message : body)}`, res.status, 'Git Gateway');
|
||||
}
|
||||
|
||||
return body;
|
||||
});
|
||||
this.acceptRoles = roles;
|
||||
if (github_enabled) {
|
||||
this.backendType = 'github';
|
||||
|
Loading…
x
Reference in New Issue
Block a user