Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
edx-platform-release
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hsin-Yu Chien
edx-platform-release
Commits
a8afe5ed
Commit
a8afe5ed
authored
12 years ago
by
Victor Shnayder
Browse files
Options
Downloads
Patches
Plain Diff
Change modulestore to use a logging error handler
* log errors, but don't fail
parent
9c92aef6
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
common/lib/xmodule/xmodule/errorhandlers.py
+22
-2
22 additions, 2 deletions
common/lib/xmodule/xmodule/errorhandlers.py
common/lib/xmodule/xmodule/modulestore/xml.py
+2
-2
2 additions, 2 deletions
common/lib/xmodule/xmodule/modulestore/xml.py
with
24 additions
and
4 deletions
common/lib/xmodule/xmodule/errorhandlers.py
+
22
−
2
View file @
a8afe5ed
import
logging
import
sys
log
=
logging
.
getLogger
(
__name__
)
def
in_exception_handler
():
'''
Is there an active exception?
'''
return
sys
.
exc_info
()
!=
(
None
,
None
,
None
)
def
strict_error_handler
(
msg
,
exc_info
=
None
):
'''
Do not let errors pass. If exc_info is not None, ignore msg, and just
...
...
@@ -11,13 +18,26 @@ def strict_error_handler(msg, exc_info=None):
if
exc_info
is
not
None
:
raise
exc_info
[
0
],
exc_info
[
1
],
exc_info
[
2
]
# Check if there is an exception being handled somewhere up the stack
if
sys
.
exc_info
()
!=
(
None
,
None
,
None
):
if
in_exception_handler
():
raise
raise
Exception
(
msg
)
def
logging_error_handler
(
msg
,
exc_info
=
None
):
'''
Log all errors, but otherwise let them pass, relying on the caller to
workaround.
'''
if
exc_info
is
not
None
:
log
.
exception
(
msg
,
exc_info
=
exc_info
)
return
if
in_exception_handler
():
log
.
exception
(
msg
)
return
log
.
error
(
msg
)
def
ignore_errors_handler
(
msg
,
exc_info
=
None
):
'''
Ignore all errors, relying on the caller to workaround.
Meant for use in the LMS, where an error in one part of the course
...
...
This diff is collapsed.
Click to expand it.
common/lib/xmodule/xmodule/modulestore/xml.py
+
2
−
2
View file @
a8afe5ed
...
...
@@ -3,7 +3,7 @@ from fs.osfs import OSFS
from
importlib
import
import_module
from
lxml
import
etree
from
path
import
path
from
xmodule.errorhandlers
import
strict
_error_handler
from
xmodule.errorhandlers
import
logging
_error_handler
from
xmodule.x_module
import
XModuleDescriptor
,
XMLParsingSystem
from
xmodule.mako_module
import
MakoDescriptorSystem
from
cStringIO
import
StringIO
...
...
@@ -100,7 +100,7 @@ class XMLModuleStore(ModuleStore):
"""
def
__init__
(
self
,
data_dir
,
default_class
=
None
,
eager
=
False
,
course_dirs
=
None
,
error_handler
=
strict
_error_handler
):
error_handler
=
logging
_error_handler
):
"""
Initialize an XMLModuleStore from data_dir
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment