[geany/www.geany.org] 27b20a: Re-raise exceptions when possible
Enrico Tröger
git-noreply at xxxxx
Sun Aug 23 15:05:38 UTC 2020
Branch: refs/heads/master
Author: Enrico Tröger <enrico.troeger at uvena.de>
Committer: Enrico Tröger <enrico.troeger at uvena.de>
Date: Sun, 23 Aug 2020 15:05:38 UTC
Commit: 27b20aa7aa210d08df4138a53bf9ef0f0b2092fb
https://github.com/geany/www.geany.org/commit/27b20aa7aa210d08df4138a53bf9ef0f0b2092fb
Log Message:
-----------
Re-raise exceptions when possible
As reported by PyLint.
Modified Paths:
--------------
geany/templatetags/geany_tags.py
pastebin/views.py
static_docs/generate_i18n_statistics.py
Modified: geany/templatetags/geany_tags.py
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -52,9 +52,9 @@ def do_evaluate(parser, token): # pylint: disable=unused-argument
"""
try:
_, variable, _, target_var_name = token.split_contents()
- except ValueError:
+ except ValueError as exc:
raise template.TemplateSyntaxError(
- '{!r} tag requires a single argument'.format(token.contents.split()[1]))
+ '{!r} tag requires a single argument'.format(token.contents.split()[1])) from exc
return EvaluateNode(variable, target_var_name)
Modified: pastebin/views.py
10 lines changed, 6 insertions(+), 4 deletions(-)
===================================================================
@@ -124,12 +124,14 @@ def get(self, request, snippet_id):
def _fetch_snippet(self, snippet_id):
try:
snippet = Snippet.objects.get(secret_id=snippet_id)
- except MultipleObjectsReturned:
+ except MultipleObjectsReturned as exc:
raise SnippetNotFoundError(
- _('Multiple snippets exist for this slug. This should never happen.'))
- except ObjectDoesNotExist:
+ _('Multiple snippets exist for this slug. This should never happen.')
+ ) from exc
+ except ObjectDoesNotExist as exc:
raise SnippetNotFoundError(
- _('This snippet does not exist anymore. Probably its lifetime is expired.'))
+ _('This snippet does not exist anymore. Probably its lifetime is expired.')
+ ) from exc
else:
return snippet
Modified: static_docs/generate_i18n_statistics.py
2 lines changed, 1 insertions(+), 1 deletions(-)
===================================================================
@@ -152,7 +152,7 @@ def _execute_command(self, command):
'Command: "{}" exited with code {}: {}'.format(
' '.join(command),
exc.returncode,
- exc.output.decode('utf-8')))
+ exc.output.decode('utf-8'))) from exc
# ----------------------------------------------------------------------
def _fetch_pot_stats(self):
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list