mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 13:27:31 -08:00
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:
parent
09bdd96d29
commit
0d33329bc8
|
@ -54,7 +54,7 @@ import { Route } from 'vue-router';
|
|||
import { executionHelpers } from '@/mixins/executionsHelpers';
|
||||
import { range as _range } from 'lodash';
|
||||
import { debounceHelper } from '@/mixins/debounce';
|
||||
import { getNodeViewTab } from '@/utils';
|
||||
import { getNodeViewTab, NO_NETWORK_ERROR_CODE } from '@/utils';
|
||||
import { workflowHelpers } from '@/mixins/workflowHelpers';
|
||||
import { mapStores } from 'pinia';
|
||||
import { useWorkflowsStore } from '@/stores/workflows';
|
||||
|
@ -372,8 +372,9 @@ export default mixins(
|
|||
if (updatedActiveExecution !== null) {
|
||||
this.workflowsStore.activeWorkflowExecution = updatedActiveExecution;
|
||||
} else {
|
||||
const activeNotInTheList =
|
||||
existingExecutions.find((ex) => ex.id === this.activeExecution.id) === undefined;
|
||||
const activeNotInTheList = !existingExecutions.some(
|
||||
(ex) => ex.id === this.activeExecution?.id,
|
||||
);
|
||||
if (activeNotInTheList && this.executions.length > 0) {
|
||||
this.$router
|
||||
.push({
|
||||
|
@ -394,7 +395,22 @@ export default mixins(
|
|||
try {
|
||||
return await this.workflowsStore.loadCurrentWorkflowExecutions(this.filter);
|
||||
} catch (error) {
|
||||
this.$showError(error, this.$locale.baseText('executionsList.showError.refreshData.title'));
|
||||
if (error.errorCode === NO_NETWORK_ERROR_CODE) {
|
||||
this.$showMessage(
|
||||
{
|
||||
title: this.$locale.baseText('executionsList.showError.refreshData.title'),
|
||||
message: error.message,
|
||||
type: 'error',
|
||||
duration: 3500,
|
||||
},
|
||||
false,
|
||||
);
|
||||
} else {
|
||||
this.$showError(
|
||||
error,
|
||||
this.$locale.baseText('executionsList.showError.refreshData.title'),
|
||||
);
|
||||
}
|
||||
return [];
|
||||
}
|
||||
},
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue