forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Streams] Centralize error handling (elastic#207858)
Centralizes the error handling by: - creating a base StatusError exception that reports a status code - having all known errors extend from StatusError and setting a default status code for that error - handling both ES response and status errors into a single place, converting them into Boom errors --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Joe Reuter <johannes.reuter@elastic.co>
- Loading branch information
1 parent
28885a7
commit c33ecb9
Showing
39 changed files
with
557 additions
and
746 deletions.
There are no files selected for viewing
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
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
15 changes: 15 additions & 0 deletions
15
...rvability/plugins/streams/server/lib/streams/errors/component_template_not_found_error.ts
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,15 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { StatusError } from './status_error'; | ||
|
||
export class ComponentTemplateNotFoundError extends StatusError { | ||
constructor(message: string) { | ||
super(message, 404); | ||
this.name = 'ComponentTemplateNotFoundError'; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ns/observability/plugins/streams/server/lib/streams/errors/definition_id_invalid_error.ts
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,15 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { StatusError } from './status_error'; | ||
|
||
export class DefinitionIdInvalidError extends StatusError { | ||
constructor(message: string) { | ||
super(message, 400); | ||
this.name = 'DefinitionIdInvalidError'; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...ons/observability/plugins/streams/server/lib/streams/errors/definition_not_found_error.ts
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,15 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { StatusError } from './status_error'; | ||
|
||
export class DefinitionNotFoundError extends StatusError { | ||
constructor(message: string) { | ||
super(message, 404); | ||
this.name = 'DefinitionNotFoundError'; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
...observability/plugins/streams/server/lib/streams/errors/detected_mapping_failure_error.ts
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,15 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { StatusError } from './status_error'; | ||
|
||
export class DetectedMappingFailureError extends StatusError { | ||
constructor(message: string) { | ||
super(message, 400); | ||
this.name = 'DetectedMappingFailureError'; | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
...lutions/observability/plugins/streams/server/lib/streams/errors/fork_condition_missing.ts
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/index.ts
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
...tions/observability/plugins/streams/server/lib/streams/errors/index_template_not_found.ts
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
...ions/observability/plugins/streams/server/lib/streams/errors/ingest_pipeline_not_found.ts
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
...k/solutions/observability/plugins/streams/server/lib/streams/errors/malformed_children.ts
This file was deleted.
Oops, something went wrong.
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
13 changes: 0 additions & 13 deletions
13
x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/malformed_fields.ts
This file was deleted.
Oops, something went wrong.
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
13 changes: 0 additions & 13 deletions
13
x-pack/solutions/observability/plugins/streams/server/lib/streams/errors/malformed_stream.ts
This file was deleted.
Oops, something went wrong.
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
13 changes: 0 additions & 13 deletions
13
.../solutions/observability/plugins/streams/server/lib/streams/errors/malformed_stream_id.ts
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
...ions/observability/plugins/streams/server/lib/streams/errors/malformed_stream_id_error.ts
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,15 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { StatusError } from './status_error'; | ||
|
||
export class MalformedStreamIdError extends StatusError { | ||
constructor(message: string) { | ||
super(message, 400); | ||
this.name = 'MalformedStreamIdError'; | ||
} | ||
} |
13 changes: 0 additions & 13 deletions
13
...lutions/observability/plugins/streams/server/lib/streams/errors/non_additive_processor.ts
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
...s/observability/plugins/streams/server/lib/streams/errors/non_additive_processor_error.ts
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,15 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import { StatusError } from './status_error'; | ||
|
||
export class NonAdditiveProcessorError extends StatusError { | ||
constructor(message: string) { | ||
super(message, 400); | ||
this.name = 'NonAdditiveProcessorError'; | ||
} | ||
} |
Oops, something went wrong.