Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Map CouchDB errors to HyperErrs #39

Open
3 tasks
TillaTheHun0 opened this issue Mar 13, 2023 · 0 comments
Open
3 tasks

Map CouchDB errors to HyperErrs #39

TillaTheHun0 opened this issue Mar 13, 2023 · 0 comments
Labels
enhancement New feature or request errors

Comments

@TillaTheHun0
Copy link
Member

I'd consider this more of an enhancement.

A "HyperErr" is a simple object of the shape:

{
  ok: false,
  status: 404, // optional
  msg: 'not found' // optional
}

It happens that most CouchDB responses follow this shape, and so mapping is unnecessary most of the time, and we already do mapping on some apis ie. retrieveDocument maps 404, createDocument maps/handles 409, 400 and 403, etc.

But I do think this adapter could do a better job of explicitly mapping per request statuses to specific HyperErrs instead of just accepting whatever is sent back from CouchDB. This way, the mapping can be tested.

This issue is meant to track that enhancement of the non-happy path. This includes:

  • createDatabase - should return a HyperErr if the database already exists
  • removeDatabase - should return a HyperErr if no database is found to remove
  • removeDocument - should return a HyperErr if no document is found to remove

These above have commented out tests that can be used to verify we've implemented the expectation. But there are lots of errors that could be returned from Couch

Ideally, the solution is something that is reusable to handle all sorts of CouchDB errors, similar to the approach for mapping errors in the elasticsearch adapter

@TillaTheHun0 TillaTheHun0 added enhancement New feature or request errors labels Mar 13, 2023
@TillaTheHun0 TillaTheHun0 moved this to 📋 Backlog in Public Board Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request errors
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant