From f22c10c70dacf69c18ac650c51346beebf5f502e Mon Sep 17 00:00:00 2001 From: Evgeniy Alekseev Date: Tue, 5 Sep 2023 18:06:48 +0300 Subject: [PATCH] verbose multiarchitectureerror --- src/ahriman/application/handlers/handler.py | 2 +- src/ahriman/core/exceptions.py | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/ahriman/application/handlers/handler.py b/src/ahriman/application/handlers/handler.py index ea0ad520..3e5dfdb2 100644 --- a/src/ahriman/application/handlers/handler.py +++ b/src/ahriman/application/handlers/handler.py @@ -96,7 +96,7 @@ class Handler: # actually we do not have to spawn another process if it is single-process application, do we? if len(repositories) > 1: if not cls.ALLOW_MULTI_ARCHITECTURE_RUN: - raise MultipleArchitecturesError(args.command) + raise MultipleArchitecturesError(args.command, repositories) with Pool(len(repositories)) as pool: result = pool.starmap(cls.call, [(args, repository_id) for repository_id in repositories]) diff --git a/src/ahriman/core/exceptions.py b/src/ahriman/core/exceptions.py index f342a0fe..5687f83e 100644 --- a/src/ahriman/core/exceptions.py +++ b/src/ahriman/core/exceptions.py @@ -23,6 +23,8 @@ from collections.abc import Callable from pathlib import Path from typing import Any, Self +from ahriman.models.repository_id import RepositoryId + class BuildError(RuntimeError): """ @@ -173,14 +175,18 @@ class MultipleArchitecturesError(ValueError): exception which will be raised if multiple architectures are not supported by the handler """ - def __init__(self, command: str) -> None: + def __init__(self, command: str, repositories: list[RepositoryId] | None = None) -> None: """ default constructor Args: command(str): command name which throws exception + repositories(list[RepositoryId] | None, optional): found repository list (Default value = None) """ - ValueError.__init__(self, f"Multiple architectures/repositories are not supported by subcommand {command}") + message = f"Multiple architectures/repositories are not supported by subcommand {command}" + if repositories is not None: + message += f", got {repositories}" + ValueError.__init__(self, message) class OptionError(ValueError):