Last active
August 29, 2015 14:03
-
-
Save gasi/7c1e85b755e72f55b573 to your computer and use it in GitHub Desktop.
Express Streamline #11 Bug
This file contains hidden or 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
express = require 'express-streamline' | |
app = express() | |
# Throw sync error | |
fail = -> throw new Error 'FAIL!' | |
app.get '/good', (req, res, _) -> | |
fail() # Throw sync error without async function call | |
app.get '/bad', (req, res, _) -> | |
setTimeout _, 1000 | |
fail() # Throw sync error after async function call | |
app.use (err, req, res, _) -> | |
# Never reached for `/bad` | |
res.send "Caught: #{err}" | |
console.log 'http://localhost:8000' | |
app.listen 8000 |
This file contains hidden or 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
http://localhost:8000 | |
# Go to http://localhost:8000/bad | |
~/express-streamline-11/node_modules/streamline/lib/callbacks/runtime.js:103 | |
if (___.dispatched && _.name !== '___' && _.name !== '__trap') throw ex; | |
^ | |
Error: FAIL! | |
at fail (~/express-streamline-11/index._coffee:9:11) | |
at __$__2 (~/express-streamline-11/index._coffee:18:24) | |
at [object Object].___ [as _onTimeout] (~/express-streamline-11/node_modules/streamline/lib/callbacks/runtime.js:100:13) | |
at Timer.listOnTimeout [as ontimeout] (timers.js:110:15) |
This file contains hidden or 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
{ | |
"name": "express-streamline-11", | |
"version": "0.0.0", | |
"description": "Repro for `express-streamline` #11 bug", | |
"main": "index.js", | |
"author": "Daniel Gasienica", | |
"license": "MIT", | |
"dependencies": { | |
"coffee-script": "1.7.1", | |
"express": "4.4.5", | |
"express-streamline": "0.3.1", | |
"streamline": "0.10.7" | |
} | |
} |
This file contains hidden or 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
npm install && ./node_modules/.bin/_coffee index._coffee |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment