Permalink
Browse files

refactored error handling based on code review by @nciagra

  • Loading branch information...
1 parent 57ca201 commit 92798848697bdfcd90d5dffd9e1cb1d615d8ffc3 @snookca snookca committed Aug 20, 2012
Showing with 29 additions and 31 deletions.
  1. +11 −11 lib/batman.js
  2. +11 −11 lib/dist/batman.node.js
  3. +7 −9 src/routing/dispatcher.coffee
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
View

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -70,15 +70,13 @@ class Batman.Dispatcher extends Batman.Object
else
@get('app.currentParams').clear()
- isPrevented = false
- if Batman.currentApp
- Batman.currentApp.fire 'error', {
- type: '404'
- preventDefault: =>
- isPrevented = true
- }
-
- return params if isPrevented
+ error =
+ type: '404'
+ isPrevented: false
+ preventDefault: -> @isPrevented = true
+
+ Batman.currentApp?.fire 'error', error
+ return params if error.isPrevented
return Batman.redirect('/404') unless params is '/404'
path

0 comments on commit 9279884

Please sign in to comment.