mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
* Handle the case where saving to history may throw an error We should still show the request result even if localStorage is full (or any other save error occurs) * Update src/plugins/console/public/application/hooks/use_send_current_request_to_es/use_send_current_request_to_es.ts Co-Authored-By: Alison Goryachev <alisonmllr20@gmail.com> Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com> Co-authored-by: Alison Goryachev <alisonmllr20@gmail.com> Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
This commit is contained in:
parent
6b36427959
commit
423d18cbd9
1 changed files with 12 additions and 3 deletions
|
@ -39,7 +39,7 @@ export const useSendCurrentRequestToES = () => {
|
|||
const requests = await editor.getRequestsInRange();
|
||||
if (!requests.length) {
|
||||
notifications.toasts.add(
|
||||
i18n.translate('console.notification.noReqeustSelectedTitle', {
|
||||
i18n.translate('console.notification.error.noRequestSelectedTitle', {
|
||||
defaultMessage:
|
||||
'No request selected. Select a request by placing the cursor inside it.',
|
||||
})
|
||||
|
@ -55,7 +55,16 @@ export const useSendCurrentRequestToES = () => {
|
|||
const results = await sendRequestToES({ requests });
|
||||
|
||||
results.forEach(({ request: { path, method, data } }) => {
|
||||
history.addToHistory(path, method, data);
|
||||
try {
|
||||
history.addToHistory(path, method, data);
|
||||
} catch (e) {
|
||||
// Best effort, but notify the user.
|
||||
notifications.toasts.addError(e, {
|
||||
title: i18n.translate('console.notification.error.couldNotSaveRequestTitle', {
|
||||
defaultMessage: 'Could not save request to history.',
|
||||
}),
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
const { polling } = settings.toJSON();
|
||||
|
@ -85,7 +94,7 @@ export const useSendCurrentRequestToES = () => {
|
|||
payload: undefined,
|
||||
});
|
||||
notifications.toasts.addError(e, {
|
||||
title: i18n.translate('console.notification.unknownRequestErrorTitle', {
|
||||
title: i18n.translate('console.notification.error.unknownErrorTitle', {
|
||||
defaultMessage: 'Unknown Request Error',
|
||||
}),
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue