⚠️ Exceptions¶
All Oinker exceptions inherit from OinkerError for easy catching.
from oinker import OinkerError
try:
await piglet.dns.list("example.com")
except OinkerError as e:
print(f"Something went wrong: {e}")
Exception Hierarchy¶
OinkerError
├── AuthenticationError
├── AuthorizationError
├── RateLimitError
├── NotFoundError
├── ValidationError
└── APIError
Exceptions¶
OinkerError¶
oinker.OinkerError
¶
Bases: Exception
Base exception for all oinker errors.
Catch this to handle any oinker-related error.
AuthenticationError¶
oinker.AuthenticationError
¶
Bases: OinkerError
Invalid or missing API credentials.
Oops! Couldn't authenticate. Check your API keys aren't hogwash.
AuthorizationError¶
oinker.AuthorizationError
¶
Bases: OinkerError
Valid credentials but not authorized for this domain/action.
You're authenticated, but this pen isn't yours to root around in.
RateLimitError¶
oinker.RateLimitError
¶
Bases: OinkerError
Rate limit exceeded.
Whoa there! Slow your trot. Try again later.
Initialize with optional retry delay.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Error message. |
required |
retry_after
|
float | None
|
Seconds to wait before retrying. |
None
|
Source code in src/oinker/_exceptions.py
NotFoundError¶
oinker.NotFoundError
¶
Bases: OinkerError
Domain or record not found.
Couldn't find that in the pen. Double-check the domain/record ID.
ValidationError¶
oinker.ValidationError
¶
APIError¶
oinker.APIError
¶
Bases: OinkerError
Generic API error with status code and message.
Something went wrong at the farm. Check the details.
Initialize with status code.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Error message from the API. |
required |
status_code
|
int | None
|
HTTP status code if available. |
None
|