Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Should AnyDB wrap errors? #13

Closed
grncdr opened this Issue · 2 comments

2 participants

Stephen Sugden Brian C
Stephen Sugden
Owner

From the README:

Things it might do:

  • Wrap errors.

Is this desirable? For now, you have to deal with whatever error types/constructors the underlying driver uses, but it might be nice to have a normalized hierarchy of error types as part of AnyDB.

Otherwise, we assume that users are either:

  • fine with their code being coupled to a specific driver
  • using a library that provides another level of abstraction (e.g. gesundheit) on top of AnyDB, and that this library should be responsible for normalizing errors.

I'm comfortable with those assumptions, but not confident that I've considered all angles of the issue.

Brian C

wrapping errors is tricky business. Mostly, I think reacting to errors in any non-trivial way (i.e. not just logging the error and returning a 500 to the request) is going to almost require you react in a way specific to the actual database you're using. If one absolutely desires to have wrapped, standarized errors, I would definitely suggest doing this within a separate module.

I know a lot of the node "clergy" harp on doing one thing and one thing only with a module; sometimes it seems a bit excesive.

It is not.

The less each individual module does the more composable they all become. So maybe another module like node-db-errors or something that can standardize errors if someone wants that.

Stephen Sugden
Owner

All good very good reasons. I don't see any compelling argument for including error wrappers in AnyDB, but I'm open to somebody re-opening this issue at a later date.

Stephen Sugden grncdr closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.