-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Adding better error reporting for reading and importing data (#2…
…4269) * [ML] Adding better error reporting for reading and importing data * changes to endpoint errors * displaying errors * step logic refactor * removing log statements
- Loading branch information
1 parent
890608d
commit 4df3ee8
Showing
9 changed files
with
389 additions
and
129 deletions.
There are no files selected for viewing
63 changes: 63 additions & 0 deletions
63
x-pack/plugins/ml/public/file_datavisualizer/components/import_view/errors.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
|
||
import React from 'react'; | ||
|
||
import { | ||
EuiCallOut, | ||
} from '@elastic/eui'; | ||
|
||
import { IMPORT_STATUS } from './import_progress'; | ||
|
||
export function Errors({ errors, statuses }) { | ||
return ( | ||
<EuiCallOut | ||
title={title(statuses)} | ||
color="danger" | ||
iconType="cross" | ||
> | ||
{ | ||
errors.map((e, i) => ( | ||
<p key={i}> | ||
{ toString(e) } | ||
</p> | ||
)) | ||
} | ||
|
||
</EuiCallOut> | ||
); | ||
} | ||
|
||
function title(statuses) { | ||
switch (IMPORT_STATUS.FAILED) { | ||
case statuses.readStatus: | ||
return 'Error reading file'; | ||
case statuses.indexCreatedStatus: | ||
return 'Error creating index'; | ||
case statuses.ingestPipelineCreatedStatus: | ||
return 'Error creating ingest pipeline'; | ||
case statuses.uploadStatus: | ||
return 'Error uploading data'; | ||
case statuses.indexPatternCreatedStatus: | ||
return 'Error creating index pattern'; | ||
default: | ||
return 'Error'; | ||
} | ||
} | ||
|
||
function toString(error) { | ||
if (typeof error === 'object') { | ||
if (error.msg !== undefined) { | ||
return error.msg; | ||
} else if (error.error !== undefined) { | ||
return error.error; | ||
} else { | ||
return error.toString(); | ||
} | ||
} | ||
return error; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.