[8.18] [Synthetics] Error details - Improved network error handling (#224296) (#224445)

# Backport

This will backport the following commits from `main` to `8.18`:
- [[Synthetics] Error details - Improved network error handling
(#224296)](https://github.com/elastic/kibana/pull/224296)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT [{"author":{"name":"Francesco
Fagnani","email":"fagnani.francesco@gmail.com"},"sourceCommit":{"committedDate":"2025-06-18T14:58:17Z","message":"[Synthetics]
Error details - Improved network error handling (#224296)\n\nThis PR
improves how we handle network errors in the Error details page\nin
Synthetics.\n\n**Before**\n\n\nf187e9cf-2f5b-4322-b433-6be267f44893","sha":"415c32d440e0e10acec0523e9752cdb00d8a095e","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:obs-ux-management","backport:version","v9.1.0","v8.19.0","author:obs-ux-management","v9.0.3","v8.18.3","v8.17.8"],"title":"[Synthetics]
Error details - Improved network error
handling","number":224296,"url":"https://github.com/elastic/kibana/pull/224296","mergeCommit":{"message":"[Synthetics]
Error details - Improved network error handling (#224296)\n\nThis PR
improves how we handle network errors in the Error details page\nin
Synthetics.\n\n**Before**\n\n\nf187e9cf-2f5b-4322-b433-6be267f44893","sha":"415c32d440e0e10acec0523e9752cdb00d8a095e"}},"sourceBranch":"main","suggestedTargetBranches":["8.19","9.0","8.18","8.17"],"targetPullRequestStates":[{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224296","number":224296,"mergeCommit":{"message":"[Synthetics]
Error details - Improved network error handling (#224296)\n\nThis PR
improves how we handle network errors in the Error details page\nin
Synthetics.\n\n**Before**\n\n\nf187e9cf-2f5b-4322-b433-6be267f44893","sha":"415c32d440e0e10acec0523e9752cdb00d8a095e"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"9.0","label":"v9.0.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.18","label":"v8.18.3","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.17","label":"v8.17.8","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Francesco Fagnani <fagnani.francesco@gmail.com>
This commit is contained in:
Kibana Machine 2025-06-18 18:47:42 +02:00 committed by GitHub
parent 1d5547d90e
commit 70e0ee45ae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View file

@ -8,6 +8,8 @@
import { call, put, takeEvery } from 'redux-saga/effects';
import { Action } from 'redux-actions';
import { i18n } from '@kbn/i18n';
import { kibanaService } from '../../../../utils/kibana_service';
import { serializeHttpFetchError } from '../utils/http_error';
import { EsActionPayload, EsActionResponse, executeEsQueryAction } from './actions';
import { executeEsQueryAPI } from './api';
@ -30,8 +32,19 @@ export function* executeEsQueryEffect() {
}
} catch (e) {
inProgressRequests.delete(action.payload.name);
yield put(executeEsQueryAction.fail(serializeHttpFetchError(e, action.payload)));
const serializedError = serializeHttpFetchError(e, action.payload);
kibanaService.coreSetup.notifications.toasts.addError(
{ ...e, message: serializedError.body?.message ?? e.message },
{
title: ES_QUERY_FAIL_MESSAGE,
}
);
yield put(executeEsQueryAction.fail(serializedError));
}
}
);
}
const ES_QUERY_FAIL_MESSAGE = i18n.translate('xpack.synthetics.esQuery.failed', {
defaultMessage: 'ES query failed.',
});

View file

@ -35,7 +35,7 @@ export const elasticsearchReducer = createReducer(initialState, (builder) => {
state.results = { ...state.results, [name]: action.payload.result };
})
.addCase(executeEsQueryAction.fail, (state, action) => {
const name = action.payload.name;
const name = action.payload.getPayload?.name!;
state.loading = { ...state.loading, [name]: false };
state.error = { ...state.error, [name]: action.payload };
});