DataSourceSettings: use details from HealthCheckResult (#32759)

* add custom HealthCheckError

* allow details from HealthCheckResult to be passed in the error

* pass in details.message from testing status into Alert component

* add chance

* add aria label to read only message

* update tests and add error message tests

* extract HealthCheckResultDetails type out and add comment

* extract TestingStatus interface out

* remove chance from test

* remove chance
This commit is contained in:
Vicky Lee
2021-04-08 13:32:12 +01:00
committed by GitHub
parent fe67680c42
commit 59a33d98ec
8 changed files with 165 additions and 528 deletions

View File

@@ -95,15 +95,10 @@ export const testDataSource = (
dispatch(testDataSourceSucceeded(result));
} catch (err) {
let message = '';
const { statusText, message: errMessage, details } = err;
const message = statusText ? 'HTTP error ' + statusText : errMessage;
if (err.statusText) {
message = 'HTTP error ' + err.statusText;
} else {
message = err.message;
}
dispatch(testDataSourceFailed({ message }));
dispatch(testDataSourceFailed({ message, details }));
}
});
};