Initial commit: Python SDK for Dragonchain (Prime)
Synchronous Python SDK modeled on prime-sdk-go. Provides DC1-HMAC-SHA256 auth, dataclass models, and resource clients for system, transaction, transaction-type, smart-contract, and block endpoints, plus a YAML credentials loader.
This commit is contained in:
19
prime_sdk/errors.py
Normal file
19
prime_sdk/errors.py
Normal file
@@ -0,0 +1,19 @@
|
||||
"""Exceptions raised by the Dragonchain SDK."""
|
||||
|
||||
|
||||
class DragonchainError(Exception):
|
||||
"""Base class for all errors raised by the SDK."""
|
||||
|
||||
|
||||
class DragonchainAPIError(DragonchainError):
|
||||
"""Raised when the Dragonchain node returns an HTTP error (status >= 400).
|
||||
|
||||
Attributes:
|
||||
status_code: The HTTP status code returned by the node.
|
||||
body: The (trimmed) response body returned by the node.
|
||||
"""
|
||||
|
||||
def __init__(self, status_code: int, body: str):
|
||||
self.status_code = status_code
|
||||
self.body = body
|
||||
super().__init__(f"API error (status {status_code}): {body}")
|
||||
Reference in New Issue
Block a user