mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2025-08-09 16:33:26 +02:00
Add thiserror instead of exposing eyre anonymous errors
The change here is to make it easier for the consumer to debug the api. Such that they can `match` on individual errors instead of having to parse text. eyre is convenient, but mostly from a consumers perspective
This commit is contained in:
27
crates/dagger-sdk/src/errors.rs
Normal file
27
crates/dagger-sdk/src/errors.rs
Normal file
@@ -0,0 +1,27 @@
|
||||
use thiserror::Error;
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum ConnectError {
|
||||
#[error("failed to connect to dagger engine")]
|
||||
FailedToConnect(#[source] eyre::Error),
|
||||
}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum DaggerError {
|
||||
#[error("failed to build dagger internal graph")]
|
||||
Build(#[source] eyre::Error),
|
||||
#[error("failed to parse input type")]
|
||||
Serialize(#[source] eyre::Error),
|
||||
#[error("failed to query dagger engine: {0}")]
|
||||
Query(#[source] dagger_core::graphql_client::GraphQLError),
|
||||
#[error("failed to unpack response")]
|
||||
Unpack(#[source] DaggerUnpackError),
|
||||
}
|
||||
|
||||
#[derive(Error, Debug)]
|
||||
pub enum DaggerUnpackError {
|
||||
#[error("Too many nested objects inside graphql response")]
|
||||
TooManyNestedObjects,
|
||||
#[error("failed to deserialize response")]
|
||||
Deserialize(#[source] serde_json::Error),
|
||||
}
|
Reference in New Issue
Block a user