Results
No results found.
Locker Secret SDK offers some kinds of errors. They can reflect external events, like invalid credentials, network interruptions, or code problems, like invalid API calls.
If an immediate problem prevents a function from continuing, the SDK raises an exception. It’s a best practice to catch and handle exceptions. To catch an exception, use Python’s try/except
syntax. Catch locker.error.LockerError
or its subclasses to handle Locker-specific exceptions only. Each subclass represents a different kind of exception. When you catch an exception, you can use its class to choose a response.
Example:
from locker import Locker
from locker.error import LockerError
# Create a new secret and handle error
try:
new_secret = locker.create(key="YOUR_KEY", value="your_key_value", environment_name="staging")
print(new_secret.key, new_secret.value, new_secret.description, new_secret.environment_name)
except LockerError as e:
print(e.user_message)
print(e.http_body)
In the SDK, error objects belong to locker.error.LockerError
and its subclasses. Use the documentation for each class for advice about how to respond.
Code | Status code (HTTP Status code) | Name | Class | Description |
unauthorized | 401 | Authentication Error | locker.error.AuthenticationError | Invalid access_client_id or invalid secret_access_key |
permission_denied | 403 | Permission Denied Error | locker.error.PermissionDeniedError | Your credential does not have enough permission to execute this operation |
rate_limit | 429 | Rate Limit Error | locker.error.RateLimitError | Too many requests |
not_found | 404 | Resource Not Found | locker.error.ResourceNotFoundError | The requested resource is not found |
server_error | 500 | API Server Error | locker.error.APIServerError | Something went wrong on Locker’s end (These are rare) |
http_error | 503 | API Connect Error | locker.error.APIConnectionError | The request to API server error. Check your network connection |
cli_error | null | CLI Run Error | locker.error.CliRunError | The encryption/decryption binary runs error by invalid local data, process interruptions |
locker_error | null | General Locker Error | locker.error.LockerError | The general error |