Skip to content

Instantly share code, notes, and snippets.

@rishispeets
Created April 26, 2017 08:40
Show Gist options
  • Save rishispeets/6cbfa6be7e63979a05b51e3f3d467004 to your computer and use it in GitHub Desktop.
Save rishispeets/6cbfa6be7e63979a05b51e3f3d467004 to your computer and use it in GitHub Desktop.

Revisions

  1. Rishi Speets created this gist Apr 26, 2017.
    8 changes: 8 additions & 0 deletions Calback error parameter handling
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,8 @@
    var fs = require('fs')

    fs.readFile('/Does/not/exist', handleFile)

    function handleFile (error, file) {
    if (error) return console.error('Uhoh, there was an error', error)
    // otherwise, continue on and use `file` in your code
    }