pub enum ClientError {
Sdk(SdkError),
Http(Error),
InvalidCredentials,
ApplicationKeyRequestFailed {
status: String,
},
DecodeFailed {
url: String,
status: u16,
cause: Error,
payload: String,
},
ApiError {
url: String,
status: u16,
message: Option<String>,
payload: String,
retry_after: Option<Duration>,
},
}Expand description
Errors that can be returned by LibraryClient operations.
Variants§
Sdk(SdkError)
The SDK is not configured or not authenticated.
This variant is produced when DriveThruRpgSdk::library_client is called
before the SDK has been configured or before a session has been established.
Http(Error)
An HTTP transport or server error occurred.
This wraps the underlying reqwest::Error including connection failures,
timeout errors, and non-success HTTP status codes when .error_for_status() is
used.
InvalidCredentials
The provided email or password was rejected by DriveThruRPG.
Returned by credential_login::login_with_credentials when
validate_login_credentials.php indicates the credentials are invalid.
ApplicationKeyRequestFailed
Credentials were accepted but the application key request failed.
Returned by credential_login::login_with_credentials when credentials
pass validation but create_account_app.php returns a non-success status.
DecodeFailed
The HTTP response indicated a successful status but the body could not be deserialized into the expected type.
The raw response body (truncated to [LOG_PAYLOAD_LIMIT] bytes) is preserved so
callers can log the offending payload for diagnosis.
Fields
ApiError
The API returned a non-success status. message, when present, is a
human-readable explanation extracted from the response body (either a
top-level message field or field-keyed validation errors, e.g.
{"productId": "Requires a valid Product ID. Invalid value 22654728."}).
The raw response body (truncated to [LOG_PAYLOAD_LIMIT] bytes) is preserved so
callers can log the offending payload when no message could be extracted.
Fields
Trait Implementations§
Source§impl Debug for ClientError
impl Debug for ClientError
Source§impl Display for ClientError
impl Display for ClientError
Source§impl Error for ClientError
impl Error for ClientError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()