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
b8cde355
Commit
b8cde355
authored
Aug 06, 2015
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add hooks to new error reporting code
Signed-off-by:
Michal Čihař
<
michal@cihar.com
>
parent
5f39a03d
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
7 deletions
+26
-7
weblate/accounts/avatar.py
weblate/accounts/avatar.py
+6
-0
weblate/accounts/models.py
weblate/accounts/models.py
+3
-0
weblate/trans/machine/base.py
weblate/trans/machine/base.py
+12
-6
weblate/trans/views/dictionary.py
weblate/trans/views/dictionary.py
+2
-1
weblate/trans/views/files.py
weblate/trans/views/files.py
+3
-0
No files found.
weblate/accounts/avatar.py
View file @
b8cde355
...
...
@@ -19,6 +19,7 @@
#
import
urllib2
import
sys
import
urllib
import
hashlib
import
os.path
...
...
@@ -31,6 +32,7 @@ from django.conf import settings
import
weblate
from
weblate
import
appsettings
from
weblate.trans.util
import
report_error
try
:
import
libravatar
# pylint: disable=import-error
...
...
@@ -127,6 +129,10 @@ def get_avatar_image(user, size):
image
=
download_avatar_image
(
user
,
size
)
cache
.
set
(
cache_key
,
image
)
except
IOError
as
error
:
report_error
(
error
,
sys
.
exc_info
(),
extra_data
=
{
'avatar'
:
user
.
username
}
)
weblate
.
logger
.
error
(
'Failed to fetch avatar for %s: %s'
,
user
.
username
,
...
...
weblate/accounts/models.py
View file @
b8cde355
...
...
@@ -19,6 +19,7 @@
#
import
os
import
sys
import
binascii
from
smtplib
import
SMTPException
...
...
@@ -39,6 +40,7 @@ from social.apps.django_app.default.models import UserSocialAuth
from
weblate.lang.models
import
Language
from
weblate.trans.util
import
get_site_url
from
weblate.accounts.avatar
import
get_user_display
from
weblate.trans.util
import
report_error
import
weblate
from
weblate.appsettings
import
ANONYMOUS_USER_NAME
,
SITE_TITLE
...
...
@@ -50,6 +52,7 @@ def send_mails(mails):
connection
.
send_messages
(
mails
)
except
SMTPException
as
error
:
weblate
.
logger
.
error
(
'Failed to send email: %s'
,
error
)
report_error
(
error
,
sys
.
exc_info
())
def
notify_merge_failure
(
subproject
,
error
,
status
):
...
...
weblate/trans/machine/base.py
View file @
b8cde355
...
...
@@ -24,10 +24,12 @@ Base code for machine translation services.
from
django.core.cache
import
cache
from
django.conf
import
settings
from
django.core.exceptions
import
ImproperlyConfigured
import
sys
import
json
import
urllib
import
urllib2
import
weblate
from
weblate.trans.util
import
report_error
class
MachineTranslationError
(
Exception
):
...
...
@@ -171,11 +173,13 @@ class MachineTranslation(object):
try
:
languages
=
self
.
download_languages
()
except
Exception
as
exc
:
report_error
(
exc
,
sys
.
exc_info
(),
{
'mt_url'
:
self
.
request_url
,
'mt_params'
:
self
.
request_params
}
)
weblate
.
logger
.
error
(
'Failed to fetch languages from %s, using defaults
(%s: %s)
'
,
'Failed to fetch languages from %s, using defaults'
,
self
.
name
,
exc
.
__class__
.
__name__
,
str
(
exc
)
)
weblate
.
logger
.
error
(
'Last fetched URL: %s, params: %s'
,
...
...
@@ -222,11 +226,13 @@ class MachineTranslation(object):
for
trans
in
translations
]
except
Exception
as
exc
:
report_error
(
exc
,
sys
.
exc_info
(),
{
'mt_url'
:
self
.
request_url
,
'mt_params'
:
self
.
request_params
}
)
weblate
.
logger
.
error
(
'Failed to fetch translations from %s
(%s: %s)
'
,
'Failed to fetch translations from %s'
,
self
.
name
,
exc
.
__class__
.
__name__
,
str
(
exc
)
)
weblate
.
logger
.
error
(
'Last fetched URL: %s, params: %s'
,
...
...
weblate/trans/views/dictionary.py
View file @
b8cde355
...
...
@@ -28,7 +28,7 @@ from django.core.urlresolvers import reverse
from
weblate.trans.models
import
Translation
,
Dictionary
,
Change
from
weblate.lang.models
import
Language
from
weblate.trans.util
import
get_site_url
from
weblate.trans.util
import
get_site_url
,
report_error
from
weblate.trans.forms
import
WordForm
,
DictUploadForm
,
LetterForm
from
weblate.trans.views.helper
import
get_project
import
weblate
...
...
@@ -165,6 +165,7 @@ def upload_dictionary(request, project, lang):
)
%
count
)
except
Exception
as
error
:
report_error
(
error
,
sys
.
exc_info
(),
request
)
messages
.
error
(
request
,
_
(
'File upload has failed: %s'
)
%
unicode
(
error
)
)
...
...
weblate/trans/views/files.py
View file @
b8cde355
...
...
@@ -25,7 +25,9 @@ from django.contrib import messages
from
django.contrib.auth.decorators
import
permission_required
from
django.views.decorators.http
import
require_POST
from
django.http
import
Http404
import
sys
from
weblate.trans.util
import
report_error
from
weblate.trans.forms
import
get_upload_form
from
weblate.trans.views.helper
import
get_translation
...
...
@@ -135,5 +137,6 @@ def upload_translation(request, project, subproject, lang):
messages
.
error
(
request
,
_
(
'File content merge failed: %s'
)
%
unicode
(
error
)
)
report_error
(
error
,
sys
.
exc_info
(),
request
)
return
redirect
(
obj
)
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