mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 21:52:43 +08:00
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,
|
||||
}));
|
||||
} 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 [];
|
||||
}
|
||||
};
|
||||
|
@ -660,6 +660,9 @@ export class CloudWatchDatasource extends DataSourceWithBackend<CloudWatchQuery,
|
||||
catchError((err) => {
|
||||
if (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;
|
||||
|
Reference in New Issue
Block a user