use crank_adapter_graphql::GraphqlAdapterError;
use crank_adapter_grpc::GrpcAdapterError;
use crank_adapter_rest::RestAdapterError;
use crank_core::Protocol;
use crank_mapping::MappingError;
use crank_schema::SchemaError;
use thiserror::Error;

#[derive(Debug, Error)]
pub enum RuntimeError {
    #[error(transparent)]
    Schema(#[from] SchemaError),
    #[error(transparent)]
    Mapping(#[from] MappingError),
    #[error(transparent)]
    GraphqlAdapter(#[from] GraphqlAdapterError),
    #[error(transparent)]
    GrpcAdapter(#[from] GrpcAdapterError),
    #[error(transparent)]
    RestAdapter(#[from] RestAdapterError),
    #[error("protocol {protocol:?} is not supported by runtime")]
    UnsupportedProtocol { protocol: Protocol },
    #[error("invalid prepared request: {details}")]
    InvalidPreparedRequest { details: String },
}
