Custom Exceptions¶
The render_error()
function can be used to render
multi-line error messages with stem.util.term
colours.
The darc
project provides following custom exceptions:
Note
All exceptions are inherited from _BaseException
.
The darc
project provides following custom warnings:
Note
All warnings are inherited from _BaseWarning
.
-
exception
darc.error.
APIRequestFailed
[source]¶ Bases:
darc.error._BaseWarning
API submit failed.
-
exception
darc.error.
DatabaseOperaionFailed
[source]¶ Bases:
darc.error._BaseWarning
Database operation execution failed.
-
exception
darc.error.
FreenetBootstrapFailed
[source]¶ Bases:
darc.error._BaseWarning
Freenet bootstrap process failed.
-
exception
darc.error.
HookExecutionFailed
[source]¶ Bases:
darc.error._BaseWarning
Failed to execute hook function.
-
exception
darc.error.
I2PBootstrapFailed
[source]¶ Bases:
darc.error._BaseWarning
I2P bootstrap process failed.
-
exception
darc.error.
LinkNoReturn
(link=None, *, drop=True)[source]¶ Bases:
darc.error._BaseException
The link has no return value from the hooks.
- Parameters
link (darc.link.Link) – Original link object.
drop (bool) –
- Keyword Arguments
drop – If drops the
link
from task queues.- Return type
-
exception
darc.error.
LockWarning
[source]¶ Bases:
darc.error._BaseWarning
Failed to acquire Redis lock.
-
exception
darc.error.
RedisCommandFailed
[source]¶ Bases:
darc.error._BaseWarning
Redis command execution failed.
-
exception
darc.error.
SiteNotFoundWarning
[source]¶ Bases:
darc.error._BaseWarning
,ImportWarning
Site customisation not found.
-
exception
darc.error.
TorBootstrapFailed
[source]¶ Bases:
darc.error._BaseWarning
Tor bootstrap process failed.
-
exception
darc.error.
TorRenewFailed
[source]¶ Bases:
darc.error._BaseWarning
Tor renew request failed.
-
exception
darc.error.
UnsupportedLink
[source]¶ Bases:
darc.error._BaseException
The link is not supported.
-
exception
darc.error.
UnsupportedPlatform
[source]¶ Bases:
darc.error._BaseException
The platform is not supported.
-
exception
darc.error.
UnsupportedProxy
[source]¶ Bases:
darc.error._BaseException
The proxy is not supported.
-
exception
darc.error.
WorkerBreak
[source]¶ Bases:
darc.error._BaseException
Break from the worker loop.
-
exception
darc.error.
ZeroNetBootstrapFailed
[source]¶ Bases:
darc.error._BaseWarning
ZeroNet bootstrap process failed.
-
darc.error.
render_error
(message, colour)[source]¶ Render error message.
The function wraps the
stem.util.term.format()
function to provide multi-line formatting support.- Parameters
message (AnyStr) – Multi-line message to be rendered with
colour
.colour (stem.util.term.Color) – Front colour of text, c.f.
stem.util.term.Color
.
- Returns
The rendered error message.
- Return type