Skip to main content

rune_framework/
error.rs

1//! SDK error types.
2
3use thiserror::Error;
4
5/// Errors that can occur in the Rune SDK.
6#[derive(Debug, Error)]
7pub enum SdkError {
8    /// A rune with this name is already registered.
9    #[error("rune '{0}' is already registered")]
10    DuplicateRune(String),
11
12    /// Stream has already ended; cannot emit more data.
13    #[error("stream already ended")]
14    StreamEnded,
15
16    /// gRPC transport error.
17    #[error("transport error: {0}")]
18    Transport(#[from] tonic::transport::Error),
19
20    /// gRPC status error.
21    #[error("grpc error: {0}")]
22    Grpc(#[from] tonic::Status),
23
24    /// Channel send error.
25    #[error("channel send error: {0}")]
26    ChannelSend(String),
27
28    /// Handler execution error.
29    #[error("handler error: {0}")]
30    HandlerError(String),
31
32    /// Invalid URI.
33    #[error("invalid uri: {0}")]
34    InvalidUri(String),
35
36    /// Other errors.
37    #[error("{0}")]
38    Other(String),
39}
40
41/// Result alias for SDK operations.
42pub type SdkResult<T> = Result<T, SdkError>;