Skip to content

Commit

Permalink
Remove hardcoded LoginFailed output.
Browse files Browse the repository at this point in the history
  • Loading branch information
terjekv committed Jun 25, 2024
1 parent 8542420 commit ca7a272
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
4 changes: 0 additions & 4 deletions mreg_cli/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 13 additions & 7 deletions mreg_cli/utilities/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -468,7 +472,8 @@ def get_list_generic(
ok404: bool = False,
limit: int | None = 500,
expect_one_result: Literal[True] = True,
) -> Json: ...
) -> Json:
...


@overload
Expand All @@ -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(
Expand Down

0 comments on commit ca7a272

Please sign in to comment.