Skip to content

Instantly share code, notes, and snippets.

View Rahul-Bisht's full-sized avatar

Rahul Bisht Rahul-Bisht

  • innodata pvt ltd
  • new delhi
View GitHub Profile
@Rahul-Bisht
Rahul-Bisht / callback_contract.md
Created July 6, 2017 04:31 — forked from CrabDude/callback_contract.md
Node.js Callback Contract

#callback/errback contract

  1. Function that takes 2 arguments
    • first argument is an error
    • second argument is the result
    • Never pass both
    • error should be instanceof Error
  2. Must never excecute on the same tick of the event loop
  3. Must be passed as last argument to function
  4. Return value is ignored
  5. Must not throw / must pass resulting errors