Custom Error not propagated properly on throw statement or next() call
===

I'm developing a Node.js/CoffeeScript app where I'm using a class hierarchy for errors. Everything works great when I'm using `throw` statements in the root of a route handler:

    class APIError extends Error
        constructor: ->

    app.error (err, req, res, next) ->
        if err instance of APIError
           console.log 'APIError captured'

    app.get '/', (req, res, next) ->
        throw new APIError

However, with Mongoose, using `throw` statement in a callback function:

    app.get '/', (req, res, next) ->
        UserModel.where('name', 'Joe').findOne (err, doc) ->
            throw new APIError
   
results in `undefined` being printed out in the console. Same thing happens when I call `next()` instead:

    exports.index = (req, res, next) ->
        UserModel.where('name', 'Joe').findOne (err, doc) ->
            return next new APIError

or even use it in the main body of a handler:

    exports.index = (req, res, next) ->
        next new APIError

Changing the last statement to `return next Error` works as expected, i.e. an exception stack trace is being printed out in the console:

    exports.index = (req, res, next) ->
        return next Error 'This works as expected'

Is it Node.js issue or the way I'm defining classes in CoffeeScript? Any ideas how to make such error hierarchy to work?