fix(editor): Prevent workflow execution list infinite no network error (#5230)

fix(editor): Prevent workflow execution list create infinite no network error messages
This commit is contained in:
Csaba Tuncsik
2023-01-24 13:31:47 +01:00
committed by GitHub
parent 09bdd96d29
commit 0d33329bc8
2 changed files with 26 additions and 6 deletions

View File

@@ -1,6 +1,8 @@
import axios, { AxiosRequestConfig, Method } from 'axios';
import { IDataObject } from 'n8n-workflow';
import type { IRestApiContext } from '../Interface';
import type { IRestApiContext } from '@/Interface';
export const NO_NETWORK_ERROR_CODE = 999;
class ResponseError extends Error {
// The HTTP status code of response
@@ -67,7 +69,9 @@ async function request(config: {
return response.data;
} catch (error) {
if (error.message === 'Network Error') {
throw new ResponseError('API-Server can not be reached. It is probably down.');
throw new ResponseError('API-Server can not be reached. It is probably down.', {
errorCode: NO_NETWORK_ERROR_CODE,
});
}
const errorResponseData = error.response.data;