Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
5f39a03d
Commit
5f39a03d
authored
Aug 06, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add shared error logging code
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
f45855bb
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
weblate/trans/util.py
weblate/trans/util.py
+24
-0
No files found.
weblate/trans/util.py
View file @
5f39a03d
...
@@ -22,10 +22,18 @@ from django.core.exceptions import ImproperlyConfigured
...
@@ -22,10 +22,18 @@ from django.core.exceptions import ImproperlyConfigured
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.http
import
HttpResponseRedirect
from
django.http
import
HttpResponseRedirect
from
django.shortcuts
import
resolve_url
from
django.shortcuts
import
resolve_url
from
django.conf
import
settings
from
importlib
import
import_module
from
importlib
import
import_module
import
os
import
os
import
urlparse
import
urlparse
import
hashlib
import
hashlib
import
weblate
try
:
import
rollbar
HAS_ROLLBAR
=
True
except
ImportError
:
HAS_ROLLBAR
=
False
PLURAL_SEPARATOR
=
'
\
x1e
\
x1e
'
PLURAL_SEPARATOR
=
'
\
x1e
\
x1e
'
...
@@ -214,3 +222,19 @@ def cleanup_path(path):
...
@@ -214,3 +222,19 @@ def cleanup_path(path):
if
path
.
startswith
(
'/'
):
if
path
.
startswith
(
'/'
):
path
=
path
[
1
:]
path
=
path
[
1
:]
return
path
return
path
def
report_error
(
error
,
exc_info
,
request
=
None
,
extra_data
=
None
):
"""Wrapper for error reporting
This can be used for store exceptions in error reporting solutions as
rollbar while handling error gracefully and giving user cleaner message.
"""
if
HAS_ROLLBAR
and
hasattr
(
settings
,
'ROLLBAR'
):
rollbar
.
report_exc_info
(
exc_info
,
request
,
extra_data
=
extra_data
)
weblate
.
logger
.
error
(
'Handled exception %s: %s'
,
error
.
__class__
.
__name__
,
str
(
error
)
)
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