Skip to main content

SdkResultExt

Trait SdkResultExt 

Source
pub trait SdkResultExt<T> {
    // Required method
    fn into_sdk_error(self) -> Result<T, AlienError<GenericError>>;
}
Expand description

Extension trait for converting SDK API results to AlienError.

This properly extracts error information from progenitor’s error types, preserving API error details that would be lost with .into_alien_error().

§When to use

Use into_sdk_error() for SDK API calls:

client.sync_acquire().send().await.into_sdk_error().context(...)?

Continue using into_alien_error() for non-SDK errors (serde, std, etc.):

serde_json::to_value(&data).into_alien_error().context(...)?

§What it preserves

When the API returns an error response, into_sdk_error() preserves:

  • code: The API error code (e.g., “DEPLOYMENT_NOT_FOUND”)
  • message: The error message
  • retryable: Whether the operation can be retried
  • context: Additional error context as JSON
  • source: Nested error chain
  • HTTP status code

Required Methods§

Source

fn into_sdk_error(self) -> Result<T, AlienError<GenericError>>

Convert SDK result to AlienError result, preserving API error details.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> SdkResultExt<ResponseValue<T>> for Result<ResponseValue<T>, Error<ApiError>>

Implementors§