fix!: resolve hyper error and bubble rejected non-handled exceptions #12 #15
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm really sorry for the large PR. Most of the diff is utils and tests and lock files. I added a bunch of tests to ensure mappings from ES errors to hyper errors were correct. I can sit down on a call and walk through the changes if that helps.
various bug fixes and error mappings:
Elasticsearch will automatically create an index, if you attempt to index a document on an index that doesn't exist. It will create an "auto index" and infer fields to index based on document shape. We don't want that, so we check for existing index on indexDoc, updateDoc, bulk before performing the actual operation
properly map elasticsearch error types to hyper errors ie (index not found, doc not found, invalid mapping, etc.)
Elasticsearch reserves the _id field on index mappings and documents. So we map _id to a movedUnderscoreId63 field internally for mappings, documents, and queries, then back to an _id field when retrieving documents.
I've added a task to the gitpod config to automatically spin up opensearch.
BREAKING CHANGE - caught exceptions are resolved, not rejected, as hyper
errors
The only time a method on the adapter should return a rejected promise
is in the case of an unhandled exception.
Aligns with discussion detailed in:
https://github.com/hyper63/journal/blob/master/design-docs/003-errors.md