Skip to content

Commit

Permalink
Fix error handler ctx
Browse files Browse the repository at this point in the history
  • Loading branch information
eldargab committed Sep 3, 2012
1 parent c1d43fb commit 50b898e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ App.prototype._raise = function (p, e) {
if (parent == p) parent = ''
} while (!handler)

var proxy = p && (new Proxy(this, p))
var proxy = p ? new Proxy(this, p) : this

function raise (err) {
if (err == null) return
Expand Down
7 changes: 6 additions & 1 deletion test/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,13 @@ describe('App', function () {
throw 'error'
})

app.onerror('foo', function () {
app.onerror('foo', function (err) {
this.get('&/bar').should.equal('bar')
throw err
})

app.onerror(function () {
this.should.equal(app)
done()
})

Expand Down

0 comments on commit 50b898e

Please sign in to comment.