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
|
class App.ControllerPermanent extends App.Controller
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
|
||||||
|
|
||||||
# check authentication
|
|
||||||
if @requiredPermission
|
if @requiredPermission
|
||||||
@permissionCheckRedirect(@requiredPermission, true)
|
@permissionCheckRedirect(@requiredPermission, true)
|
||||||
|
|
||||||
|
super
|
||||||
|
|
||||||
$('.content').addClass('hide')
|
$('.content').addClass('hide')
|
||||||
@navShow()
|
@navShow()
|
||||||
|
|
||||||
class App.ControllerContent extends App.Controller
|
class App.ControllerContent extends App.Controller
|
||||||
constructor: ->
|
constructor: ->
|
||||||
super
|
|
||||||
|
|
||||||
# check authentication
|
|
||||||
if @requiredPermission
|
if @requiredPermission
|
||||||
@permissionCheckRedirect(@requiredPermission)
|
@permissionCheckRedirect(@requiredPermission)
|
||||||
|
|
||||||
|
super
|
||||||
|
|
||||||
$('.content').addClass('hide')
|
$('.content').addClass('hide')
|
||||||
$('#content').removeClass('hide')
|
$('#content').removeClass('hide')
|
||||||
@navShow()
|
@navShow()
|
||||||
|
|
|
@ -41,7 +41,7 @@ class Widget extends App.Controller
|
||||||
|
|
||||||
maintanaceMode: (data = {}) =>
|
maintanaceMode: (data = {}) =>
|
||||||
return if data.on isnt true
|
return if data.on isnt true
|
||||||
@authenticateCheckRedirect()
|
return if !@authenticateCheck()
|
||||||
@navigate '#logout'
|
@navigate '#logout'
|
||||||
|
|
||||||
#App.Event.trigger('maintenance', {type:'restart_auto'})
|
#App.Event.trigger('maintenance', {type:'restart_auto'})
|
||||||
|
|
|
@ -75,12 +75,6 @@ class App.Content extends App.ControllerWidgetPermanent
|
||||||
@el.unbind()
|
@el.unbind()
|
||||||
@el.undelegate()
|
@el.undelegate()
|
||||||
|
|
||||||
# send current controller
|
|
||||||
params_only = {}
|
|
||||||
for i of params
|
|
||||||
if typeof params[i] isnt 'object'
|
|
||||||
params_only[i] = params[i]
|
|
||||||
|
|
||||||
# remember history
|
# remember history
|
||||||
# needed to mute "redirect" url to support browser back
|
# needed to mute "redirect" url to support browser back
|
||||||
history = App.Config.get('History')
|
history = App.Config.get('History')
|
||||||
|
@ -91,7 +85,10 @@ class App.Content extends App.ControllerWidgetPermanent
|
||||||
# execute controller
|
# execute controller
|
||||||
controller = (params) =>
|
controller = (params) =>
|
||||||
params.el = @el
|
params.el = @el
|
||||||
new callback(params)
|
try
|
||||||
|
new callback(params)
|
||||||
|
catch e
|
||||||
|
@log 'error', "route #{route}:", e
|
||||||
controller(params)
|
controller(params)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue