Avoid error if response code is < 500
parent
63b3e30def
commit
5958c80ab7
|
@ -39,6 +39,9 @@ const commonConfig = {
|
||||||
* Jar of cookies to send along the request.
|
* Jar of cookies to send along the request.
|
||||||
*/
|
*/
|
||||||
jar: shared.session.cookieJar,
|
jar: shared.session.cookieJar,
|
||||||
|
validateStatus: function (status: number) {
|
||||||
|
return status < 500; // Resolve only if the status code is less than 500
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -143,6 +146,7 @@ export async function fetchGETResponse(url: string): Promise<Result<GenericAxios
|
||||||
const response = await axios.get(secureURL, commonConfig);
|
const response = await axios.get(secureURL, commonConfig);
|
||||||
return success(response);
|
return success(response);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
console.log(e.response);
|
||||||
shared.logger.error(`(GET) Error ${e.message} occurred while trying to fetch ${secureURL}`);
|
shared.logger.error(`(GET) Error ${e.message} occurred while trying to fetch ${secureURL}`);
|
||||||
const genericError = new GenericAxiosError({
|
const genericError = new GenericAxiosError({
|
||||||
id: 1,
|
id: 1,
|
||||||
|
|
Loading…
Reference in New Issue