mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-21 02:56:40 -08:00
Changed the error handling location
This commit is contained in:
parent
b873eec2ad
commit
694ec64330
|
@ -106,11 +106,7 @@ export interface IPollFunctions extends IPollFunctionsBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IResponseError extends Error {
|
export interface IResponseError extends Error {
|
||||||
status?: number; // this is how the request library returns
|
statusCode?: number;
|
||||||
response?: {
|
|
||||||
// this is how Axios returns
|
|
||||||
status: number;
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ITriggerFunctions extends ITriggerFunctionsBase {
|
export interface ITriggerFunctions extends ITriggerFunctionsBase {
|
||||||
|
|
|
@ -415,6 +415,7 @@ async function proxyRequestToAxios(
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch((error) => {
|
.catch((error) => {
|
||||||
|
error.statusCode = error.response.status;
|
||||||
reject(error);
|
reject(error);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -673,7 +674,7 @@ export async function requestOAuth2(
|
||||||
? 401
|
? 401
|
||||||
: oAuth2Options?.tokenExpiredStatusCode;
|
: oAuth2Options?.tokenExpiredStatusCode;
|
||||||
|
|
||||||
if (error.response?.status === statusCodeReturned || error.status === statusCodeReturned) {
|
if (error.statusCode === statusCodeReturned) {
|
||||||
// Token is probably not valid anymore. So try refresh it.
|
// Token is probably not valid anymore. So try refresh it.
|
||||||
|
|
||||||
const tokenRefreshOptions: IDataObject = {};
|
const tokenRefreshOptions: IDataObject = {};
|
||||||
|
|
Loading…
Reference in a new issue