-
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.
[Upgrade Assistant] Remove "boom" from reindex service (#58715)
* Removed Boom from reindex-service The reindex service had logic inside it for mapping errors to HTTP. This has been moved to the route handlers and also removed Boom. There is one more instance of Boom use inside of reindex-actions but that comes from Saved Objects which should probably be removed at a later stage. * Fix import path Specify the full relative import path to the kibana's core server folder * Remove unnecessary if statement Co-authored-by: Elastic Machine <[email protected]>
- Loading branch information
1 parent
37d18a7
commit ac5e7aa
Showing
4 changed files
with
106 additions
and
30 deletions.
There are no files selected for viewing
35 changes: 35 additions & 0 deletions
35
x-pack/plugins/upgrade_assistant/server/lib/reindexing/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,35 @@ | ||
/* | ||
* 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 { | ||
AccessForbidden, | ||
IndexNotFound, | ||
CannotCreateIndex, | ||
ReindexTaskCannotBeDeleted, | ||
ReindexTaskFailed, | ||
ReindexAlreadyInProgress, | ||
MultipleReindexJobsFound, | ||
} from './error_symbols'; | ||
|
||
export class ReindexError extends Error { | ||
constructor(message: string, public readonly symbol: symbol) { | ||
super(message); | ||
} | ||
} | ||
|
||
export const createErrorFactory = (symbol: symbol) => (message: string) => { | ||
return new ReindexError(message, symbol); | ||
}; | ||
|
||
export const error = { | ||
indexNotFound: createErrorFactory(IndexNotFound), | ||
accessForbidden: createErrorFactory(AccessForbidden), | ||
cannotCreateIndex: createErrorFactory(CannotCreateIndex), | ||
reindexTaskFailed: createErrorFactory(ReindexTaskFailed), | ||
reindexTaskCannotBeDeleted: createErrorFactory(ReindexTaskCannotBeDeleted), | ||
reindexAlreadyInProgress: createErrorFactory(ReindexAlreadyInProgress), | ||
multipleReindexJobsFound: createErrorFactory(MultipleReindexJobsFound), | ||
}; |
15 changes: 15 additions & 0 deletions
15
x-pack/plugins/upgrade_assistant/server/lib/reindexing/error_symbols.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; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
export const AccessForbidden = Symbol('AccessForbidden'); | ||
export const IndexNotFound = Symbol('IndexNotFound'); | ||
export const CannotCreateIndex = Symbol('CannotCreateIndex'); | ||
|
||
export const ReindexTaskFailed = Symbol('ReindexTaskFailed'); | ||
export const ReindexTaskCannotBeDeleted = Symbol('ReindexTaskCannotBeDeleted'); | ||
export const ReindexAlreadyInProgress = Symbol('ReindexAlreadyInProgress'); | ||
|
||
export const MultipleReindexJobsFound = Symbol('MultipleReindexJobsFound'); |
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