Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1384

Clean up how we throw errors in async functions

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Do
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 3.0.5
    • Component/s: Native, Operations Layer
    • Not Needed

      We have inconsistent behavior in how we handle errors in asynchronous functions.

      Ideally, we should have the following behavior:

      • Any error that occurs outside of an executeOperation call should be thrown, as we are still in synchronous boilerplate. This makes handling simple validation errors easier.
      • Any errors that occur within an executeOperation call should be passed into the callback (and by extension either call a callback with an error or reject the promise).

      We currently have behavior all over the place. Some examples:

      We should have a consistent approach to this sort of stuff.

            Assignee:
            Unassigned Unassigned
            Reporter:
            daniel.aprahamian@mongodb.com Daniel Aprahamian (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: