-
Notifications
You must be signed in to change notification settings - Fork 12
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
Interface: Error #1
Comments
Most of the errors do look like this. It's not guaranteed, though. There are certain cases where the errors are meaningful and we expect people to handle them themselves. In those cases you're supposed to look for the |
Thanks @nolanlawson . Is it predictable per-method which type of error comes back, or is it more to do with things like dealing with remote/local databases? |
@AGBrown Some good examples of 'other' errors are in the PouchDB constructor: https://github.com/pouchdb/pouchdb/blob/master/lib/constructor.js#L59 . On top of that, there are native adapter errors. E.g.:
Oh, and That's the ones I know but should get you started. |
@marten-de-vries, thank you I will take a look at those examples. As background for this discussion: the old pouch.d.ts (for 0.1) defined a shape (an interface) for errors, and then set that as the shape used by many of the callbacks (including My thinking has now evolved based on all the input so far. I think we are trying to work out if there is a predictable shape for an error, either for:
† Thus far, as per your and @nolanlawson 's comments, I can now see that (1) would be misleading and worse than to specify the error type as This is the example code I mentioned above from the old d.ts. This isn't good for the developer as when running your code the error you got would presumably be passed to the callback. The developer would then expect the
|
I have now reviewed |
What is the shape of an error (as passed to a callback/promise)?
Proposed shape:
The text was updated successfully, but these errors were encountered: