Skip to content

jmwalletd.errors

jmwalletd.errors

Custom exception types for the wallet daemon API.

Each exception maps to a specific HTTP status code and error message, matching the reference JoinMarket implementation's error semantics.

Classes

ActionNotAllowed

Bases: JMWalletDaemonError

400 - The requested action is not allowed in the current state.

Source code in jmwalletd/src/jmwalletd/errors.py
28
29
30
31
32
class ActionNotAllowed(JMWalletDaemonError):
    """400 - The requested action is not allowed in the current state."""

    status_code = 400
    detail = "Action not allowed."
Attributes
detail = 'Action not allowed.' class-attribute instance-attribute
status_code = 400 class-attribute instance-attribute

BackendNotReady

Bases: JMWalletDaemonError

503 - The blockchain backend is not available.

Source code in jmwalletd/src/jmwalletd/errors.py
140
141
142
143
144
class BackendNotReady(JMWalletDaemonError):
    """503 - The blockchain backend is not available."""

    status_code = 503
    detail = "Backend daemon not available."
Attributes
detail = 'Backend daemon not available.' class-attribute instance-attribute
status_code = 503 class-attribute instance-attribute

ConfigNotPresent

Bases: JMWalletDaemonError

409 - Required config section/field does not exist.

Source code in jmwalletd/src/jmwalletd/errors.py
105
106
107
108
109
class ConfigNotPresent(JMWalletDaemonError):
    """409 - Required config section/field does not exist."""

    status_code = 409
    detail = "Action cannot be performed, config vars are not set."
Attributes
detail = 'Action cannot be performed, config vars are not set.' class-attribute instance-attribute
status_code = 409 class-attribute instance-attribute

InsufficientScope

Bases: JMWalletDaemonError

403 - Token does not have the required scope.

Source code in jmwalletd/src/jmwalletd/errors.py
49
50
51
52
53
class InsufficientScope(JMWalletDaemonError):
    """403 - Token does not have the required scope."""

    status_code = 403
    detail = "Insufficient scope."
Attributes
detail = 'Insufficient scope.' class-attribute instance-attribute
status_code = 403 class-attribute instance-attribute

InvalidCredentials

Bases: JMWalletDaemonError

401 - Wrong password or credentials.

Source code in jmwalletd/src/jmwalletd/errors.py
35
36
37
38
39
class InvalidCredentials(JMWalletDaemonError):
    """401 - Wrong password or credentials."""

    status_code = 401
    detail = "Invalid credentials."
Attributes
detail = 'Invalid credentials.' class-attribute instance-attribute
status_code = 401 class-attribute instance-attribute

InvalidRequestFormat

Bases: JMWalletDaemonError

400 - Malformed or invalid request body.

Source code in jmwalletd/src/jmwalletd/errors.py
21
22
23
24
25
class InvalidRequestFormat(JMWalletDaemonError):
    """400 - Malformed or invalid request body."""

    status_code = 400
    detail = "Invalid request format."
Attributes
detail = 'Invalid request format.' class-attribute instance-attribute
status_code = 400 class-attribute instance-attribute

InvalidToken

Bases: JMWalletDaemonError

401 - Bearer token is invalid, expired, or missing.

Source code in jmwalletd/src/jmwalletd/errors.py
42
43
44
45
46
class InvalidToken(JMWalletDaemonError):
    """401 - Bearer token is invalid, expired, or missing."""

    status_code = 401
    detail = "Invalid token."
Attributes
detail = 'Invalid token.' class-attribute instance-attribute
status_code = 401 class-attribute instance-attribute

JMWalletDaemonError

Bases: Exception

Base exception for all wallet daemon errors.

Source code in jmwalletd/src/jmwalletd/errors.py
10
11
12
13
14
15
16
17
18
class JMWalletDaemonError(Exception):
    """Base exception for all wallet daemon errors."""

    status_code: int = 500
    detail: str = "Internal server error."

    def __init__(self, detail: str | None = None) -> None:
        self.detail = detail or self.__class__.detail
        super().__init__(self.detail)
Attributes
detail: str = detail or self.__class__.detail class-attribute instance-attribute
status_code: int = 500 class-attribute instance-attribute
Methods:
__init__(detail: str | None = None) -> None
Source code in jmwalletd/src/jmwalletd/errors.py
16
17
18
def __init__(self, detail: str | None = None) -> None:
    self.detail = detail or self.__class__.detail
    super().__init__(self.detail)

LockExists

Bases: JMWalletDaemonError

409 - A lock file prevents the operation.

Source code in jmwalletd/src/jmwalletd/errors.py
 98
 99
100
101
102
class LockExists(JMWalletDaemonError):
    """409 - A lock file prevents the operation."""

    status_code = 409
    detail = "Wallet cannot be created/opened, it is locked."
Attributes
detail = 'Wallet cannot be created/opened, it is locked.' class-attribute instance-attribute
status_code = 409 class-attribute instance-attribute

NoWalletFound

Bases: JMWalletDaemonError

404 - No wallet is currently loaded.

Source code in jmwalletd/src/jmwalletd/errors.py
56
57
58
59
60
class NoWalletFound(JMWalletDaemonError):
    """404 - No wallet is currently loaded."""

    status_code = 404
    detail = "No wallet loaded."
Attributes
detail = 'No wallet loaded.' class-attribute instance-attribute
status_code = 404 class-attribute instance-attribute

NotEnoughCoinsForMaker

Bases: JMWalletDaemonError

409 - No confirmed coins available to start maker.

Source code in jmwalletd/src/jmwalletd/errors.py
119
120
121
122
123
class NotEnoughCoinsForMaker(JMWalletDaemonError):
    """409 - No confirmed coins available to start maker."""

    status_code = 409
    detail = "Maker could not start, no confirmed coins."
Attributes
detail = 'Maker could not start, no confirmed coins.' class-attribute instance-attribute
status_code = 409 class-attribute instance-attribute

NotEnoughCoinsForTumbler

Bases: JMWalletDaemonError

409 - No confirmed coins available to start tumbler.

Source code in jmwalletd/src/jmwalletd/errors.py
126
127
128
129
130
class NotEnoughCoinsForTumbler(JMWalletDaemonError):
    """409 - No confirmed coins available to start tumbler."""

    status_code = 409
    detail = "Tumbler could not start, no confirmed coins."
Attributes
detail = 'Tumbler could not start, no confirmed coins.' class-attribute instance-attribute
status_code = 409 class-attribute instance-attribute

ServiceAlreadyStarted

Bases: JMWalletDaemonError

401 - Maker/taker service is already running.

Source code in jmwalletd/src/jmwalletd/errors.py
70
71
72
73
74
class ServiceAlreadyStarted(JMWalletDaemonError):
    """401 - Maker/taker service is already running."""

    status_code = 401
    detail = "Service already started."
Attributes
detail = 'Service already started.' class-attribute instance-attribute
status_code = 401 class-attribute instance-attribute

ServiceNotStarted

Bases: JMWalletDaemonError

401 - Cannot stop a service that is not running.

Source code in jmwalletd/src/jmwalletd/errors.py
77
78
79
80
81
class ServiceNotStarted(JMWalletDaemonError):
    """401 - Cannot stop a service that is not running."""

    status_code = 401
    detail = "Service cannot be stopped as it is not running."
Attributes
detail = 'Service cannot be stopped as it is not running.' class-attribute instance-attribute
status_code = 401 class-attribute instance-attribute

TransactionFailed

Bases: JMWalletDaemonError

409 - The transaction could not be completed.

Source code in jmwalletd/src/jmwalletd/errors.py
112
113
114
115
116
class TransactionFailed(JMWalletDaemonError):
    """409 - The transaction could not be completed."""

    status_code = 409
    detail = "Transaction failed."
Attributes
detail = 'Transaction failed.' class-attribute instance-attribute
status_code = 409 class-attribute instance-attribute

WalletAlreadyExists

Bases: JMWalletDaemonError

409 - The wallet file already exists and cannot be overwritten.

Source code in jmwalletd/src/jmwalletd/errors.py
91
92
93
94
95
class WalletAlreadyExists(JMWalletDaemonError):
    """409 - The wallet file already exists and cannot be overwritten."""

    status_code = 409
    detail = "Wallet file cannot be overwritten."
Attributes
detail = 'Wallet file cannot be overwritten.' class-attribute instance-attribute
status_code = 409 class-attribute instance-attribute

WalletAlreadyUnlocked

Bases: JMWalletDaemonError

401 - Another wallet is already unlocked.

Source code in jmwalletd/src/jmwalletd/errors.py
84
85
86
87
88
class WalletAlreadyUnlocked(JMWalletDaemonError):
    """401 - Another wallet is already unlocked."""

    status_code = 401
    detail = "Wallet already unlocked."
Attributes
detail = 'Wallet already unlocked.' class-attribute instance-attribute
status_code = 401 class-attribute instance-attribute

WalletNotFound

Bases: JMWalletDaemonError

404 - The requested wallet file does not exist.

Source code in jmwalletd/src/jmwalletd/errors.py
63
64
65
66
67
class WalletNotFound(JMWalletDaemonError):
    """404 - The requested wallet file does not exist."""

    status_code = 404
    detail = "Wallet file not found."
Attributes
detail = 'Wallet file not found.' class-attribute instance-attribute
status_code = 404 class-attribute instance-attribute

YieldGeneratorDataUnreadable

Bases: JMWalletDaemonError

404 - The yield generator report file is not available.

Source code in jmwalletd/src/jmwalletd/errors.py
133
134
135
136
137
class YieldGeneratorDataUnreadable(JMWalletDaemonError):
    """404 - The yield generator report file is not available."""

    status_code = 404
    detail = "Yield generator report not available."
Attributes
detail = 'Yield generator report not available.' class-attribute instance-attribute
status_code = 404 class-attribute instance-attribute