-
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.
Merge branch '7.x' into backport/7.x/pr-57764
- Loading branch information
Showing
4 changed files
with
115 additions
and
38 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
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,37 @@ | ||
/* | ||
* 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, | ||
CannotReindexSystemIndexInCurrent, | ||
} 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), | ||
reindexSystemIndex: createErrorFactory(CannotReindexSystemIndexInCurrent), | ||
multipleReindexJobsFound: createErrorFactory(MultipleReindexJobsFound), | ||
}; |
16 changes: 16 additions & 0 deletions
16
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,16 @@ | ||
/* | ||
* 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 CannotReindexSystemIndexInCurrent = Symbol('CannotReindexSystemIndexInCurrent'); | ||
|
||
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