mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Tidy up error message handling
This commit is contained in:
parent
fd07b3d431
commit
aa2f52a2a1
@ -2,7 +2,6 @@ import { css } from '@emotion/css';
|
|||||||
import React, { useMemo } from 'react';
|
import React, { useMemo } from 'react';
|
||||||
|
|
||||||
import { dateMath, GrafanaTheme2 } from '@grafana/data';
|
import { dateMath, GrafanaTheme2 } from '@grafana/data';
|
||||||
import { isFetchError } from '@grafana/runtime';
|
|
||||||
import { CollapsableSection, Icon, Link, LinkButton, useStyles2, Stack, Alert, LoadingPlaceholder } from '@grafana/ui';
|
import { CollapsableSection, Icon, Link, LinkButton, useStyles2, Stack, Alert, LoadingPlaceholder } from '@grafana/ui';
|
||||||
import { useQueryParams } from 'app/core/hooks/useQueryParams';
|
import { useQueryParams } from 'app/core/hooks/useQueryParams';
|
||||||
import { alertSilencesApi } from 'app/features/alerting/unified/api/alertSilencesApi';
|
import { alertSilencesApi } from 'app/features/alerting/unified/api/alertSilencesApi';
|
||||||
@ -109,8 +108,8 @@ const SilencesTable = ({ alertManagerSourceName }: Props) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isFetchError(error)) {
|
if (error) {
|
||||||
const errMessage = error?.message || 'Unknown error.';
|
const errMessage = stringifyErrorLike(error) || 'Unknown error.';
|
||||||
return (
|
return (
|
||||||
<Alert severity="error" title="Error loading silences">
|
<Alert severity="error" title="Error loading silences">
|
||||||
{errMessage}
|
{errMessage}
|
||||||
|
Loading…
Reference in New Issue
Block a user