CloudWatch Logs: Fix crash when no region is configured (#37639)
This commit is contained in:
@@ -119,7 +119,15 @@ export class CloudWatchLogsQueryField extends React.PureComponent<CloudWatchLogs
|
|||||||
label: logGroup,
|
label: logGroup,
|
||||||
}));
|
}));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
dispatch(notifyApp(createErrorNotification(err)));
|
let errMessage = 'unknown error';
|
||||||
|
if (typeof err !== 'string') {
|
||||||
|
try {
|
||||||
|
errMessage = JSON.stringify(err);
|
||||||
|
} catch (e) {}
|
||||||
|
} else {
|
||||||
|
errMessage = err;
|
||||||
|
}
|
||||||
|
dispatch(notifyApp(createErrorNotification(errMessage)));
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -660,6 +660,9 @@ export class CloudWatchDatasource extends DataSourceWithBackend<CloudWatchQuery,
|
|||||||
catchError((err) => {
|
catchError((err) => {
|
||||||
if (err.data?.error) {
|
if (err.data?.error) {
|
||||||
throw err.data.error;
|
throw err.data.error;
|
||||||
|
} else if (err.data?.message) {
|
||||||
|
// In PROD we do not supply .error
|
||||||
|
throw err.data.message;
|
||||||
}
|
}
|
||||||
|
|
||||||
throw err;
|
throw err;
|
||||||
|
|||||||
Reference in New Issue
Block a user