feature(database-connection): Fix error handling
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
2021-01-28 00:03:28 +01:00
parent 9db53d5354
commit 721421294f
10 changed files with 90 additions and 35 deletions

View File

@@ -5,12 +5,13 @@ export default class UserStatsService {
private static apiURL = 'https://api.tsotr.humenius.me/stats'
// private static apiURL = 'http://localhost:3500/stats'
//private static apiURL = 'https://mock.codes/501'
private static requestInit: RequestInit = {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
'Content-Type': 'application/json',
},
};
public static async getStats(seasonId: string): Promise<UserStatsResponse> {
@@ -27,9 +28,7 @@ export default class UserStatsService {
private static checkResponse(response: any): any {
if (!response.ok) {
console.log(response);
let error = new RequestError(response.statusText);
error.response = response;
throw error;
throw new RequestError(response.status, response.body);
}
return response;
}