pub enum FileUploadError {
FileReadError(Error),
UploadError(Error),
InvalidContentType,
UnexpectedStatusCode(StatusCode),
InvalidURL(String),
}
Expand description
Errors that can occur during file uploads
These errors represent various failures that may occur when uploading files to Baserow, either directly or via URL.
§Example
use baserow_rs::{ConfigBuilder, Baserow, error::FileUploadError, api::client::BaserowClient};
use std::fs::File;
#[tokio::main]
async fn main() {
let config = ConfigBuilder::new()
.base_url("https://api.baserow.io")
.api_key("your-api-key")
.build();
let baserow = Baserow::with_configuration(config);
let file = File::open("image.jpg").unwrap();
match baserow.upload_file(file, "image.jpg".to_string()).await {
Ok(uploaded) => println!("File uploaded: {}", uploaded.url),
Err(FileUploadError::FileReadError(e)) => {
println!("Failed to read file: {}", e)
}
Err(e) => println!("Upload failed: {}", e),
}
}
Variants§
FileReadError(Error)
UploadError(Error)
InvalidContentType
UnexpectedStatusCode(StatusCode)
InvalidURL(String)
Trait Implementations§
Source§impl Debug for FileUploadError
impl Debug for FileUploadError
Source§impl Display for FileUploadError
impl Display for FileUploadError
Source§impl Error for FileUploadError
impl Error for FileUploadError
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 FileUploadError
impl From<Error> for FileUploadError
Auto Trait Implementations§
impl Freeze for FileUploadError
impl !RefUnwindSafe for FileUploadError
impl Send for FileUploadError
impl Sync for FileUploadError
impl Unpin for FileUploadError
impl !UnwindSafe for FileUploadError
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