Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Scientific Software
MDANSE
Commits
45eff477
Commit
45eff477
authored
Jul 09, 2015
by
eric pellegrini
Browse files
Modified the sys.excepthook to capture all exceptions occuring in a
MDANSE session
parent
aead403b
Changes
1
Hide whitespace changes
Inline
Side-by-side
MDANSE/App/GUI/MainFrame.py
View file @
45eff477
...
...
@@ -33,6 +33,7 @@ Created on Apr 14, 2015
import
collections
import
operator
import
os
import
sys
import
webbrowser
import
wx
...
...
@@ -49,19 +50,55 @@ from MDANSE.App.GUI.Icons import ICONS
from
MDANSE.App.GUI.WorkingPanel
import
WorkingPanel
from
MDANSE.App.GUI.PluginsTreePanel
import
PluginsTreePanel
def
excepthook
(
error
,
message
,
tback
):
'''
Called when an exception is raised and uncaught.
Redirect the exception information to the nMolDyn logger at the ERROR level.
@param typ: the exception class.
@type typ: exception
@param value: the exception instance.
@type value: exception
@param tback: the traceback.
@type tback: traceback instance
'''
import
traceback
from
MDANSE.Core.Error
import
Error
tback
=
traceback
.
extract_tb
(
tback
)
trace
=
[]
if
not
issubclass
(
error
,
Error
):
for
tb
in
tback
:
trace
.
append
(
' -- '
.
join
([
str
(
t
)
for
t
in
tb
]))
trace
.
append
(
"
\n
%s: %s"
%
(
error
.
__name__
,
message
))
trace
=
'
\n
'
.
join
(
trace
)
LOGGER
(
trace
,
'error'
,[
'console'
])
class
MainFrame
(
wx
.
Frame
):
def
__init__
(
self
,
parent
,
title
=
"MDANSE: Molecular Dynamics Analysis for Neutron Scattering Experiments"
):
wx
.
Frame
.
__init__
(
self
,
parent
,
wx
.
ID_ANY
,
title
,
size
=
(
1200
,
800
))
self
.
build_dialog
()
# Add some handlers to the loggers
LOGGER
.
add_handler
(
"console"
,
REGISTRY
[
'handler'
][
'console'
](
self
.
_panels
[
"controller"
].
pages
[
"logger"
]),
level
=
"info"
)
LOGGER
.
add_handler
(
"dialog"
,
REGISTRY
[
'handler'
][
'dialog'
](),
level
=
"error"
)
LOGGER
.
start
()
sys
.
excepthook
=
excepthook
def
build_dialog
(
self
):
self
.
build_menu
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment