pub enum APIErrorInner {
Show 19 variants
UreqError(Error),
HttpError(Error),
IoError(Error),
BadRequest(QBErrorResponse),
JsonError(Error),
QBTypeError(QBTypeError),
InvalidClient,
NoIdOnRead,
NoIdOnSend,
CreateMissingItems,
DeleteMissingItems,
NoIdOnGetPDF,
ByteLengthMismatch,
NoAttachableObjects,
ThrottleLimitReached,
BatchLimitExceeded,
EnvVarError(VarError),
BatchRequestMissingItems(BatchMissingItemsError),
InvalidFile(String),
}Expand description
Detailed error types for QuickBooks API operations.
This enum contains all the specific error conditions that can occur when
interacting with the QuickBooks API. Each variant represents a different
category of failure with appropriate context information.
§Error Categories
§Network and HTTP Errors
UreqError: HTTP client errors (network, timeout, etc.)HttpError: HTTP protocol errors (malformed requests, etc.)IoError: I/O errors (file operations, etc.)
§API Response Errors
BadRequest:QuickBooksAPI returned an error responseInvalidClient: Authentication/authorization failuresThrottleLimitReached: Rate limit exceeded
§Data Validation Errors
QBTypeError: Entity validation failuresCreateMissingItems: Required fields missing for creationDeleteMissingItems: ID/sync token missing for deletionNoIdOnRead: Entity missing ID for read operation
§Query and Operation Errors
BatchRequestMissingItems: Batch operation failuresBatchLimitExceeded: Too many items in batch request
§File and Attachment Errors
NoAttachableObjects: No attachments in upload responseInvalidFile: Invalid file name or extensionByteLengthMismatch: File write operation incomplete
§PDF Generation Errors
NoIdOnGetPDF: Entity missing ID for PDF generationNoIdOnSend: Entity missing ID for email send operation
§Configuration Errors
EnvVarError: Missing or invalid environment variablesJsonError: JSON parsing/serialization errors
§Examples
use quick_oxibooks::error::{APIError, APIErrorInner};
use quickbooks_types::Customer;
fn handle_specific_errors(result: Result<Customer, APIError>) {
match result {
Ok(customer) => println!("Success: {:?}", customer.id),
Err(e) => {
match &*e {
APIErrorInner::CreateMissingItems => {
eprintln!("Please provide required fields like display_name");
}
APIErrorInner::ThrottleLimitReached => {
eprintln!("Rate limit hit, please wait before retrying");
}
APIErrorInner::BadRequest(qb_error) => {
eprintln!("QuickBooks error: {:?}", qb_error);
}
_ => eprintln!("Other error: {}", e),
}
}
}
}Variants§
UreqError(Error)
HttpError(Error)
IoError(Error)
BadRequest(QBErrorResponse)
JsonError(Error)
QBTypeError(QBTypeError)
InvalidClient
NoIdOnRead
NoIdOnSend
CreateMissingItems
DeleteMissingItems
NoIdOnGetPDF
ByteLengthMismatch
NoAttachableObjects
ThrottleLimitReached
BatchLimitExceeded
EnvVarError(VarError)
BatchRequestMissingItems(BatchMissingItemsError)
InvalidFile(String)
Trait Implementations§
Source§impl Debug for APIErrorInner
impl Debug for APIErrorInner
Source§impl Display for APIErrorInner
impl Display for APIErrorInner
Source§impl Error for APIErrorInner
impl Error for APIErrorInner
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl From<Error> for APIErrorInner
impl From<Error> for APIErrorInner
Source§impl From<Error> for APIErrorInner
impl From<Error> for APIErrorInner
Source§impl From<Error> for APIErrorInner
impl From<Error> for APIErrorInner
Source§impl From<Error> for APIErrorInner
impl From<Error> for APIErrorInner
Source§impl From<QBTypeError> for APIErrorInner
impl From<QBTypeError> for APIErrorInner
Source§fn from(source: QBTypeError) -> Self
fn from(source: QBTypeError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for APIErrorInner
impl !RefUnwindSafe for APIErrorInner
impl Send for APIErrorInner
impl Sync for APIErrorInner
impl Unpin for APIErrorInner
impl !UnwindSafe for APIErrorInner
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more