Created
April 19, 2013 17:21
-
-
Save booyaa/5421788 to your computer and use it in GitHub Desktop.
gist created by github.com/dscape/ghcopy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var request = require('request'); | |
request('http://localhost/~booyaa/trigger-404.html', function (err, response, body) { | |
if (err) { | |
throw err; | |
} | |
if (response.statusCode === 404) { | |
// throw 'file not found'; | |
throw new Error("file not found"); | |
} | |
console.log('resp: %s\nbody: %s', JSON.stringify(response, null, 4), JSON.stringify(body, null, 4)); | |
}); | |
process.on('uncaughtException', function (err) { | |
console.log('uh oh: %s', JSON.stringify(err, null, 4)); | |
process.exit(1); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment