mirror of
https://github.com/elastic/kibana.git
synced 2025-04-25 02:09:32 -04:00
* Show fatal error for unexpected errors.
This commit is contained in:
parent
6898032816
commit
03b6de2b10
1 changed files with 30 additions and 5 deletions
|
@ -26,6 +26,8 @@ import {
|
||||||
EuiTitle,
|
EuiTitle,
|
||||||
} from '@elastic/eui';
|
} from '@elastic/eui';
|
||||||
|
|
||||||
|
import { fatalError } from 'ui/notify';
|
||||||
|
|
||||||
import { CRUD_APP_BASE_PATH } from '../../constants';
|
import { CRUD_APP_BASE_PATH } from '../../constants';
|
||||||
import {
|
import {
|
||||||
getRouterLinkProps,
|
getRouterLinkProps,
|
||||||
|
@ -228,7 +230,7 @@ export class JobCreateUi extends Component {
|
||||||
this.onFieldsChange({
|
this.onFieldsChange({
|
||||||
dateHistogramField: indexPatternDateFields.length ? indexPatternDateFields[0] : null,
|
dateHistogramField: indexPatternDateFields.length ? indexPatternDateFields[0] : null,
|
||||||
}, STEP_DATE_HISTOGRAM);
|
}, STEP_DATE_HISTOGRAM);
|
||||||
}).catch(() => {
|
}).catch((error) => {
|
||||||
// We don't need to do anything if this component has been unmounted.
|
// We don't need to do anything if this component has been unmounted.
|
||||||
if (!this._isMounted) {
|
if (!this._isMounted) {
|
||||||
return;
|
return;
|
||||||
|
@ -239,10 +241,33 @@ export class JobCreateUi extends Component {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Show toast or inline error.
|
// Expect an error in the shape provided by Angular's $http service.
|
||||||
this.setState({
|
if (error && error.data) {
|
||||||
isValidatingIndexPattern: false,
|
const { error: errorString, statusCode } = error.data;
|
||||||
});
|
|
||||||
|
const indexPatternAsyncErrors = [(
|
||||||
|
<FormattedMessage
|
||||||
|
id="xpack.rollupJobs.create.errors.indexPatternValidationError"
|
||||||
|
defaultMessage="There was a problem validating this index pattern: {statusCode} {error}"
|
||||||
|
values={{ error: errorString, statusCode }}
|
||||||
|
/>
|
||||||
|
)];
|
||||||
|
|
||||||
|
this.setState({
|
||||||
|
indexPatternAsyncErrors,
|
||||||
|
indexPatternDateFields: [],
|
||||||
|
indexPatternTermsFields: [],
|
||||||
|
indexPatternHistogramFields: [],
|
||||||
|
indexPatternMetricsFields: [],
|
||||||
|
isValidatingIndexPattern: false,
|
||||||
|
});
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This error isn't an HTTP error, so let the fatal error screen tell the user something
|
||||||
|
// unexpected happened.
|
||||||
|
fatalError(error, 'Rollup Job Wizard index pattern validation');
|
||||||
});
|
});
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue