aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArthur Zamarin <arthurzam@gentoo.org>2023-12-30 15:08:33 +0200
committerArthur Zamarin <arthurzam@gentoo.org>2023-12-30 15:08:33 +0200
commitd12a4a8f647e2db7a0d88a4bc17766e652ebba36 (patch)
tree78df1a754f06d203a0e440d43a389e42fe01430a
parentdocs: some cleanup and improvements (diff)
downloadpkgdev-d12a4a8f647e2db7a0d88a4bc17766e652ebba36.tar.gz
pkgdev-d12a4a8f647e2db7a0d88a4bc17766e652ebba36.tar.bz2
pkgdev-d12a4a8f647e2db7a0d88a4bc17766e652ebba36.zip
bugs: improve error output
Signed-off-by: Arthur Zamarin <arthurzam@gentoo.org>
-rw-r--r--src/pkgdev/scripts/pkgdev_bugs.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/pkgdev/scripts/pkgdev_bugs.py b/src/pkgdev/scripts/pkgdev_bugs.py
index 1a5cd0d..0909390 100644
--- a/src/pkgdev/scripts/pkgdev_bugs.py
+++ b/src/pkgdev/scripts/pkgdev_bugs.py
@@ -406,10 +406,10 @@ class DependencyGraph:
match = self.find_best_match(deps, pkgset)
except (ValueError, IndexError):
deps_str = " , ".join(map(str, deps))
- self.err.error(
+ bugs.error(
f"unable to find match for restrictions: {deps_str}",
+ status=3,
)
- raise
results[match].add(keyword)
yield from results.items()
@@ -427,8 +427,8 @@ class DependencyGraph:
else: # no stablereq
continue
result.append(self.find_best_match([target], pkgset, False))
- except ValueError:
- raise ValueError(f"Restriction {target} has no match in repository")
+ except (ValueError, IndexError):
+ bugs.error(f"Restriction {target} has no match in repository", status=3)
self.targets = tuple(result)
def build_full_graph(self):
@@ -617,7 +617,7 @@ class DependencyGraph:
node.file_bug(api_key, auto_cc_arches, block_bugs, modified_repo, observe)
-def _load_from_stdin(out: Formatter, err: Formatter):
+def _load_from_stdin(out: Formatter):
if not sys.stdin.isatty():
out.warn("No packages were specified, reading from stdin...")
for line in sys.stdin.readlines():
@@ -626,7 +626,7 @@ def _load_from_stdin(out: Formatter, err: Formatter):
# reassign stdin to allow interactivity (currently only works for unix)
sys.stdin = open("/dev/tty")
else:
- raise arghparse.ArgumentError(None, "reading from stdin is only valid when piping data in")
+ bugs.error("reading from stdin is only valid when piping data in")
@bugs.bind_main_func
@@ -637,7 +637,7 @@ def main(options, out: Formatter, err: Formatter):
options.targets.extend(d.extend_maintainers())
options.targets.extend(d.extend_targets_stable_groups(options.sets or ()))
if not options.targets:
- options.targets = list(_load_from_stdin(out, err))
+ options.targets = list(_load_from_stdin(out))
d.load_targets(options.targets)
d.build_full_graph()
d.merge_stabilization_groups()