-
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.
Browse files
Browse the repository at this point in the history
* [fix/UiSettings] ignore certain errors (#13079) * [savedObjects/mappingFallback] check for body.error.type * [savedObjectsClient] decorate non-es errors
- Loading branch information
Showing
42 changed files
with
1,203 additions
and
174 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
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
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/core_plugins/kibana/server/routes/api/settings/register_delete.js
This file was deleted.
Oops, something went wrong.
15 changes: 0 additions & 15 deletions
15
src/core_plugins/kibana/server/routes/api/settings/register_get.js
This file was deleted.
Oops, something went wrong.
21 changes: 0 additions & 21 deletions
21
src/core_plugins/kibana/server/routes/api/settings/register_set.js
This file was deleted.
Oops, something went wrong.
20 changes: 0 additions & 20 deletions
20
src/core_plugins/kibana/server/routes/api/settings/register_set_many.js
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
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
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
89 changes: 89 additions & 0 deletions
89
src/server/saved_objects/client/lib/__tests__/decorate_es_error.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,89 @@ | ||
import expect from 'expect.js'; | ||
import { errors as esErrors } from 'elasticsearch'; | ||
|
||
import { decorateEsError } from '../decorate_es_error'; | ||
import { | ||
isEsUnavailableError, | ||
isConflictError, | ||
isNotAuthorizedError, | ||
isForbiddenError, | ||
isNotFoundError, | ||
isBadRequestError, | ||
} from '../errors'; | ||
|
||
describe('savedObjectsClient/decorateEsError', () => { | ||
it('always returns the same error it receives', () => { | ||
const error = new Error(); | ||
expect(decorateEsError(error)).to.be(error); | ||
}); | ||
|
||
it('makes es.ConnectionFault a SavedObjectsClient/EsUnavailable error', () => { | ||
const error = new esErrors.ConnectionFault(); | ||
expect(isEsUnavailableError(error)).to.be(false); | ||
expect(decorateEsError(error)).to.be(error); | ||
expect(isEsUnavailableError(error)).to.be(true); | ||
}); | ||
|
||
it('makes es.ServiceUnavailable a SavedObjectsClient/EsUnavailable error', () => { | ||
const error = new esErrors.ServiceUnavailable(); | ||
expect(isEsUnavailableError(error)).to.be(false); | ||
expect(decorateEsError(error)).to.be(error); | ||
expect(isEsUnavailableError(error)).to.be(true); | ||
}); | ||
|
||
it('makes es.NoConnections a SavedObjectsClient/EsUnavailable error', () => { | ||
const error = new esErrors.NoConnections(); | ||
expect(isEsUnavailableError(error)).to.be(false); | ||
expect(decorateEsError(error)).to.be(error); | ||
expect(isEsUnavailableError(error)).to.be(true); | ||
}); | ||
|
||
it('makes es.RequestTimeout a SavedObjectsClient/EsUnavailable error', () => { | ||
const error = new esErrors.RequestTimeout(); | ||
expect(isEsUnavailableError(error)).to.be(false); | ||
expect(decorateEsError(error)).to.be(error); | ||
expect(isEsUnavailableError(error)).to.be(true); | ||
}); | ||
|
||
it('makes es.Conflict a SavedObjectsClient/Conflict error', () => { | ||
const error = new esErrors.Conflict(); | ||
expect(isConflictError(error)).to.be(false); | ||
expect(decorateEsError(error)).to.be(error); | ||
expect(isConflictError(error)).to.be(true); | ||
}); | ||
|
||
it('makes es.AuthenticationException a SavedObjectsClient/NotAuthorized error', () => { | ||
const error = new esErrors.AuthenticationException(); | ||
expect(isNotAuthorizedError(error)).to.be(false); | ||
expect(decorateEsError(error)).to.be(error); | ||
expect(isNotAuthorizedError(error)).to.be(true); | ||
}); | ||
|
||
it('makes es.Forbidden a SavedObjectsClient/Forbidden error', () => { | ||
const error = new esErrors.Forbidden(); | ||
expect(isForbiddenError(error)).to.be(false); | ||
expect(decorateEsError(error)).to.be(error); | ||
expect(isForbiddenError(error)).to.be(true); | ||
}); | ||
|
||
it('makes es.NotFound a SavedObjectsClient/NotFound error', () => { | ||
const error = new esErrors.NotFound(); | ||
expect(isNotFoundError(error)).to.be(false); | ||
expect(decorateEsError(error)).to.be(error); | ||
expect(isNotFoundError(error)).to.be(true); | ||
}); | ||
|
||
it('makes es.BadRequest a SavedObjectsClient/BadRequest error', () => { | ||
const error = new esErrors.BadRequest(); | ||
expect(isBadRequestError(error)).to.be(false); | ||
expect(decorateEsError(error)).to.be(error); | ||
expect(isBadRequestError(error)).to.be(true); | ||
}); | ||
|
||
it('returns other errors as Boom errors', () => { | ||
const error = new Error(); | ||
expect(error).to.not.have.property('isBoom'); | ||
expect(decorateEsError(error)).to.be(error); | ||
expect(error).to.have.property('isBoom'); | ||
}); | ||
}); |
Oops, something went wrong.