File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
x-pack/solutions/observability/plugins/synthetics
public/apps/synthetics/components/monitor_details/hooks Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ import {
1515 selectEncryptedSyntheticsSavedMonitors ,
1616 selectMonitorListState ,
1717 selectorMonitorDetailsState ,
18- selectorError ,
18+ selectSyntheticsMonitorError ,
1919} from '../../../state' ;
2020import { useGetUrlParams } from '../../../hooks' ;
2121
@@ -37,7 +37,7 @@ export const useSelectedMonitor = ({
3737 ( ) => monitorsList . find ( ( monitor ) => monitor [ ConfigKey . CONFIG_ID ] === monitorId ) ?? null ,
3838 [ monitorId , monitorsList ]
3939 ) ;
40- const error = useSelector ( selectorError ) ;
40+ const error = useSelector ( selectSyntheticsMonitorError ) ;
4141 const { lastRefresh, refreshInterval } = useSyntheticsRefreshContext ( ) ;
4242 const { syntheticsMonitor, syntheticsMonitorLoading, syntheticsMonitorDispatchedAt } =
4343 useSelector ( selectorMonitorDetailsState ) ;
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ import type { EncryptedSavedObjectsClient } from '@kbn/encrypted-saved-objects-p
2020import { withApmSpan } from '@kbn/apm-data-access-plugin/server/utils/with_apm_span' ;
2121import { isEmpty , isEqual } from 'lodash' ;
2222import type { Logger } from '@kbn/logging' ;
23+ import { SavedObjectsErrorHelpers } from '@kbn/core-saved-objects-server' ;
2324import { MONITOR_SEARCH_FIELDS } from '../routes/common' ;
2425import {
2526 legacyMonitorAttributes ,
@@ -65,7 +66,10 @@ export class MonitorConfigRepository {
6566 ] ) ;
6667 const resolved = results . saved_objects . find ( ( obj ) => obj ?. attributes ) ;
6768 if ( ! resolved ) {
68- throw new Error ( 'Monitor not found' ) ;
69+ throw SavedObjectsErrorHelpers . createGenericNotFoundError (
70+ syntheticsMonitorSavedObjectType ,
71+ id
72+ ) ;
6973 }
7074 return resolved ;
7175 }
You can’t perform that action at this time.
0 commit comments