Added try/catch block to handle exceptions.
This commit is contained in:
commit
8fd97df19a
3 changed files with 9 additions and 14 deletions
|
@ -640,23 +640,21 @@ class App.Controller extends Spine.Controller
|
|||
|
||||
class App.ControllerPermanent extends App.Controller
|
||||
constructor: ->
|
||||
super
|
||||
|
||||
# check authentication
|
||||
if @requiredPermission
|
||||
@permissionCheckRedirect(@requiredPermission, true)
|
||||
|
||||
super
|
||||
|
||||
$('.content').addClass('hide')
|
||||
@navShow()
|
||||
|
||||
class App.ControllerContent extends App.Controller
|
||||
constructor: ->
|
||||
super
|
||||
|
||||
# check authentication
|
||||
if @requiredPermission
|
||||
@permissionCheckRedirect(@requiredPermission)
|
||||
|
||||
super
|
||||
|
||||
$('.content').addClass('hide')
|
||||
$('#content').removeClass('hide')
|
||||
@navShow()
|
||||
|
|
|
@ -41,7 +41,7 @@ class Widget extends App.Controller
|
|||
|
||||
maintanaceMode: (data = {}) =>
|
||||
return if data.on isnt true
|
||||
@authenticateCheckRedirect()
|
||||
return if !@authenticateCheck()
|
||||
@navigate '#logout'
|
||||
|
||||
#App.Event.trigger('maintenance', {type:'restart_auto'})
|
||||
|
|
|
@ -75,12 +75,6 @@ class App.Content extends App.ControllerWidgetPermanent
|
|||
@el.unbind()
|
||||
@el.undelegate()
|
||||
|
||||
# send current controller
|
||||
params_only = {}
|
||||
for i of params
|
||||
if typeof params[i] isnt 'object'
|
||||
params_only[i] = params[i]
|
||||
|
||||
# remember history
|
||||
# needed to mute "redirect" url to support browser back
|
||||
history = App.Config.get('History')
|
||||
|
@ -91,7 +85,10 @@ class App.Content extends App.ControllerWidgetPermanent
|
|||
# execute controller
|
||||
controller = (params) =>
|
||||
params.el = @el
|
||||
try
|
||||
new callback(params)
|
||||
catch e
|
||||
@log 'error', "route #{route}:", e
|
||||
controller(params)
|
||||
)
|
||||
|
||||
|
|
Loading…
Reference in a new issue