diff --git a/mreg_cli/exceptions.py b/mreg_cli/exceptions.py index c5d93890..cbbedae1 100644 --- a/mreg_cli/exceptions.py +++ b/mreg_cli/exceptions.py @@ -234,8 +234,4 @@ def formatted_exception(self) -> str: """ return f"Login failed: {self.escape()}" - def __str__(self) -> str: - """Return the error message.""" - return "Login failed" - pass diff --git a/mreg_cli/utilities/api.py b/mreg_cli/utilities/api.py index 1aaff555..dbb8997e 100644 --- a/mreg_cli/utilities/api.py +++ b/mreg_cli/utilities/api.py @@ -146,7 +146,7 @@ def prompt_for_password_and_login(user: str, url: str, catch_exception: bool = T if catch_exception: e.print_self() else: - raise LoginFailedError() from e + raise LoginFailedError("Updating token failed.") from e def logout() -> None: @@ -294,19 +294,23 @@ def _request_wrapper( @overload -def get(path: str, params: QueryParams | None, ok404: Literal[True]) -> Response | None: ... +def get(path: str, params: QueryParams | None, ok404: Literal[True]) -> Response | None: + ... @overload -def get(path: str, params: QueryParams | None, ok404: Literal[False]) -> Response: ... +def get(path: str, params: QueryParams | None, ok404: Literal[False]) -> Response: + ... @overload -def get(path: str, params: QueryParams | None = ..., *, ok404: bool) -> Response | None: ... +def get(path: str, params: QueryParams | None = ..., *, ok404: bool) -> Response | None: + ... @overload -def get(path: str, params: QueryParams | None = ...) -> Response: ... +def get(path: str, params: QueryParams | None = ...) -> Response: + ... def get(path: str, params: QueryParams | None = None, ok404: bool = False) -> Response | None: @@ -468,7 +472,8 @@ def get_list_generic( ok404: bool = False, limit: int | None = 500, expect_one_result: Literal[True] = True, -) -> Json: ... +) -> Json: + ... @overload @@ -478,7 +483,8 @@ def get_list_generic( ok404: bool = False, limit: int | None = 500, expect_one_result: Literal[False] = False, -) -> list[Json]: ... +) -> list[Json]: + ... def get_list_generic(