Skip to content

Commit

Permalink
Push exception raising
Browse files Browse the repository at this point in the history
Instead of yealding a flag value and then raises an exception,
directly raise the same exception (RuntimeError)
  • Loading branch information
gdetrez committed Feb 18, 2016
1 parent cfd85ab commit 4903451
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 0 additions & 6 deletions bugwarrior/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@
)


# Sentinel value used for aborting processing of tasks
ABORT_PROCESSING = 2


class URLShortener(object):
_instance = None

Expand Down Expand Up @@ -335,8 +331,6 @@ def _bool_option(section, option, default):
}

for issue in issue_generator:
if isinstance(issue, tuple) and issue[0] == ABORT_PROCESSING:
raise RuntimeError(issue[1])
try:
existing_uuid = find_local_uuid(
tw, key_list, issue, legacy_matching=legacy_matching
Expand Down
6 changes: 4 additions & 2 deletions bugwarrior/services/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from taskw.task import Task

from bugwarrior.config import asbool, get_service_password
from bugwarrior.db import MARKUP, URLShortener, ABORT_PROCESSING
from bugwarrior.db import MARKUP, URLShortener


# Sentinels for process completion status
Expand Down Expand Up @@ -563,9 +563,11 @@ def aggregate_issues(conf, main_section):
completion_type, args = issue
if completion_type == SERVICE_FINISHED_ERROR:
target, e = args
log.name('bugwarrior').info("Terminating workers")
for process in processes:
process.terminate()
yield ABORT_PROCESSING, e
raise RuntimeError(
"critical error in target '{}'".format(target))
currently_running -= 1
continue
yield issue
Expand Down

0 comments on commit 4903451

Please sign in to comment.