diff --git a/.betterer.results b/.betterer.results index 66562bf277d..7bd18516f5a 100644 --- a/.betterer.results +++ b/.betterer.results @@ -2158,10 +2158,6 @@ exports[`better eslint`] = { [0, 0, 0, "Styles should be written using objects.", "3"], [0, 0, 0, "Styles should be written using objects.", "4"] ], - "public/app/features/alerting/unified/components/silences/SilencesTable.tsx:5381": [ - [0, 0, 0, "Do not use any type assertions.", "0"], - [0, 0, 0, "Do not use any type assertions.", "1"] - ], "public/app/features/alerting/unified/hooks/useAlertmanagerConfig.ts:5381": [ [0, 0, 0, "Do not use any type assertions.", "0"] ], diff --git a/public/app/features/alerting/unified/components/silences/SilencesTable.tsx b/public/app/features/alerting/unified/components/silences/SilencesTable.tsx index ba5691f5389..d2d63114ed9 100644 --- a/public/app/features/alerting/unified/components/silences/SilencesTable.tsx +++ b/public/app/features/alerting/unified/components/silences/SilencesTable.tsx @@ -2,6 +2,7 @@ import { css } from '@emotion/css'; import React, { useMemo } from 'react'; import { dateMath, GrafanaTheme2 } from '@grafana/data'; +import { isFetchError } from '@grafana/runtime'; import { CollapsableSection, Icon, Link, LinkButton, useStyles2, Stack, Alert } from '@grafana/ui'; import { useQueryParams } from 'app/core/hooks/useQueryParams'; import { alertSilencesApi } from 'app/features/alerting/unified/api/alertSilencesApi'; @@ -59,8 +60,7 @@ const SilencesTable = ({ alertManagerSourceName }: Props) => { ); const mimirLazyInitError = - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (error as any)?.message?.includes('the Alertmanager is not configured') && amFeatures?.lazyConfigInit; + isFetchError(error) && error?.message?.includes('the Alertmanager is not configured') && amFeatures?.lazyConfigInit; const styles = useStyles2(getStyles); const [queryParams] = useQueryParams(); @@ -109,9 +109,8 @@ const SilencesTable = ({ alertManagerSourceName }: Props) => { ); } - if (error) { - // eslint-disable-next-line @typescript-eslint/no-explicit-any - const errMessage = (error as any)?.message || 'Unknown error.'; + if (isFetchError(error)) { + const errMessage = error?.message || 'Unknown error.'; return ( {errMessage}