feature(database-connection): Fix error handling
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user