[Ingest Manager] Define custom errors by extending Error#69966
[Ingest Manager] Define custom errors by extending Error#69966jfsiii merged 3 commits intoelastic:masterfrom jfsiii:use-extends-error
Conversation
|
@elasticmachine merge upstream |
| export enum IngestManagerErrorType { | ||
| RegistryError, | ||
| } | ||
| export class RegistryError extends IngestManagerError {} |
There was a problem hiding this comment.
I chose to extend IngestManagerError here so that it gets the benefits of the stack trace naming from https://github.com/elastic/kibana/pull/69966/files#diff-305aab707fa2746fa91c6bec9e78c0b7R11 and remain an IngestManagerError
However, even if it did extend Error we could make a type like
type IngestManagerErrorType = IngestManagerError | RegistryErrorThis is where my mind is heading now. Files will define/export Errors where they are used (or perhaps lifted to common or server), and then those can be imported and combined into other types
|
Pinging @elastic/ingest-management (Team:Ingest Management) |
|
@elasticmachine merge upstream |
💚 Build SucceededBuild metrics
History
To update your PR or re-run it, just comment with: |
nchaulet
left a comment
There was a problem hiding this comment.
LGTM 🚀 It's nice to make things more "standard"
|
I'm going to merge this so I can use this pattern in some other places, and because it's not difficult to roll back, but I'm happy to revisit this if anyone wants. |
…ata-streams * 'master' of github.com:elastic/kibana: (50 commits) [Logs UI] [Alerting] "Group by" functionality (elastic#68250) [Discover] Deangularize Skip to bottom button (elastic#69811) Implement recursive plugin discovery (elastic#68811) Use ts-expect-error in platform code (elastic#69883) [SIEM][Detection Engine][Lists] Moves getQueryFilter to common folder for use by both front and backend [Ingest Manager][SECURITY SOLUTION] adjust config reassign link and add roundtrip to Reassignment flow (elastic#70208) [Security][Lists] Add API functions and react hooks for value list APIs (elastic#69603) [ILM] Fix bug when clearing priority field (elastic#70154) [Platform][Security] Updates cluster_manager ignorePaths to include security scripts (elastic#70139) [IngestManager] Allow to filter agent by packages (elastic#69731) [code coverage] exclude folders: test_helpers, tests_bundle (elastic#70199) [Metrics UI] UX improvements for saved views (elastic#69910) [APM] docs: unique transaction troubleshooting (elastic#69831) Cross cluster search functional test with minimun privileges assigned to the test_user (elastic#70007) [Maps] choropleth layer wizard (elastic#69699) Make custom errors by extending Error (elastic#69966) [Ingest Manager] Support updated package output structure (elastic#69864) Resolver test coverage (elastic#70246) Async Discover search test (elastic#64388) [ui-shared-deps] include styled-components (elastic#69322) ... # Conflicts: # x-pack/plugins/snapshot_restore/server/types.ts
…bana into alerting/consumer-based-rbac * 'alerting/consumer-based-rbac' of github.com:gmmorris/kibana: (49 commits) [Discover] Deangularize Skip to bottom button (elastic#69811) Implement recursive plugin discovery (elastic#68811) Use ts-expect-error in platform code (elastic#69883) [SIEM][Detection Engine][Lists] Moves getQueryFilter to common folder for use by both front and backend [Ingest Manager][SECURITY SOLUTION] adjust config reassign link and add roundtrip to Reassignment flow (elastic#70208) [Security][Lists] Add API functions and react hooks for value list APIs (elastic#69603) [ILM] Fix bug when clearing priority field (elastic#70154) [Platform][Security] Updates cluster_manager ignorePaths to include security scripts (elastic#70139) [IngestManager] Allow to filter agent by packages (elastic#69731) [code coverage] exclude folders: test_helpers, tests_bundle (elastic#70199) [Metrics UI] UX improvements for saved views (elastic#69910) [APM] docs: unique transaction troubleshooting (elastic#69831) Cross cluster search functional test with minimun privileges assigned to the test_user (elastic#70007) [Maps] choropleth layer wizard (elastic#69699) Make custom errors by extending Error (elastic#69966) [Ingest Manager] Support updated package output structure (elastic#69864) Resolver test coverage (elastic#70246) Async Discover search test (elastic#64388) [ui-shared-deps] include styled-components (elastic#69322) SECURITY-ENDPOINT: add host properties (elastic#70238) ...
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
|
Friendly reminder: Looks like this PR hasn’t been backported yet. |
Summary
Create Error types using
extends. e.g. define new types withand create with
Why this way?
kibana/x-pack/plugins/ingest_manager/server/services/epm/packages/index.ts
Lines 39 to 43 in 2685654
kibana/x-pack/plugins/ingest_manager/server/services/agents/checkin/rxjs_utils.ts
Line 8 in 0c47747
enumnew CustomError('string')is a better experience thannew CustomError(CustomTypes.type, 'string')