Skip to content

Commit

Permalink
Fix redirect when missing index or saved object
Browse files Browse the repository at this point in the history
  • Loading branch information
sulemanof committed Mar 16, 2020
1 parent 3c0bc16 commit d261a0b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,11 @@ export function redirectWhenMissing({
localMappingObject = mapping;
}

return (error: SavedObjectNotFound | Error) => {
return (error: SavedObjectNotFound) => {
// if this error is not "404", rethrow
if (!(error instanceof SavedObjectNotFound)) {
// we can't check "error instanceof SavedObjectNotFound" since this class can live in a separate bundle
// and the error will be an instance of other class with the same interface (actually the copy of SavedObjectNotFound class)
if (!error.savedObjectType) {
throw error;
}

Expand Down

0 comments on commit d261a0b

Please sign in to comment.