gitea.cli.utils.errors
errors
Errors raised by the CLI itself rather than by the HTTP layer.
Classes
gitea.cli.utils.errors.CommandError
Bases: Exception
A command failed for a reason the user can act on.
execute_api_command reports these without a traceback, so the message is
the whole error the user sees: state what went wrong and what to do next.
Functions:
gitea.cli.utils.errors.unreachable_message
Build the error message for a request that never reached the instance.
A connection or timeout failure says nothing about the account, the repository or the issue, so the message points at the instance and the network instead of at whatever the command was trying to do.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error
|
Exception
|
The connection or timeout error raised by the HTTP layer. |
required |
base_url
|
str | None
|
The base URL the call was made against, when it is known. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The message describing the failure and how to act on it. |
Source code in src/gitea/cli/utils/errors.py
gitea.cli.utils.errors.request_failed_message
Build the error message for a request that failed without reaching a response.
A malformed base URL, a rejected redirect or a response body that could not be read is not the instance being unreachable, so the message claims only that the request did not complete. It names the error's type, since there is no traceback to read it from.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
error
|
Exception
|
The request error raised by the HTTP layer. |
required |
base_url
|
str | None
|
The base URL the call was made against, when it is known. |
None
|
Returns:
| Type | Description |
|---|---|
str
|
The message describing the failure and how to act on it. |