pub enum Error {
Config(ConfigError),
Gcs(GcsError),
Auth(AuthError),
Api {
endpoint: String,
status_code: u16,
message: String,
},
Validation(String),
Io(Error),
Ffmpeg(String),
Timeout(u64),
}Expand description
Unified error type for the common library.
This enum provides a single error type that can represent all error conditions across the MCP GenMedia servers, enabling consistent error handling and reporting.
Variants§
Config(ConfigError)
Configuration errors (missing env vars, invalid values)
Gcs(GcsError)
GCS operation errors (upload, download, invalid URIs)
Auth(AuthError)
Authentication errors (ADC not configured, token refresh failures)
Api
API errors with endpoint and HTTP status context
Includes the API endpoint that failed, HTTP status code, and error message for debugging and user feedback.
Fields
Validation(String)
Input validation errors
Io(Error)
File system I/O errors
Ffmpeg(String)
FFmpeg/FFprobe execution errors
Timeout(u64)
Operation timeout errors
Implementations§
Source§impl Error
impl Error
Sourcepub fn api(
endpoint: impl Into<String>,
status_code: u16,
message: impl Into<String>,
) -> Self
pub fn api( endpoint: impl Into<String>, status_code: u16, message: impl Into<String>, ) -> Self
Create a new API error with endpoint, status code, and message.
§Arguments
endpoint- The API endpoint that was calledstatus_code- The HTTP status code returnedmessage- A description of the error
§Example
use adk_rust_mcp_common::error::Error;
let err = Error::api(
"https://api.example.com/v1/generate",
500,
"Internal server error"
);
assert!(err.to_string().contains("api.example.com"));
assert!(err.to_string().contains("500"));Sourcepub fn validation(message: impl Into<String>) -> Self
pub fn validation(message: impl Into<String>) -> Self
Create a new validation error.
§Example
use adk_rust_mcp_common::error::Error;
let err = Error::validation("prompt cannot be empty");
assert!(err.to_string().contains("prompt cannot be empty"));Trait Implementations§
Source§impl Error for Error
impl Error for Error
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
Source§impl From<ConfigError> for Error
impl From<ConfigError> for Error
Source§fn from(source: ConfigError) -> Self
fn from(source: ConfigError) -> Self
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl !UnwindSafe for Error
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.