ur-registry 1.0.9

Keystone UR registry types and encoders/decoders for multi-chain payloads
Documentation
use alloc::string::String;

// Prefer std when available; otherwise fall back to core
#[cfg(feature = "std")]
extern crate thiserror as thiserror;
#[cfg(all(not(feature = "std"), feature = "core"))]
extern crate thiserror_core as thiserror;

use thiserror::Error;

#[derive(Error, Debug, PartialEq)]
pub enum URError {
    #[error("cbor decode failed, reason: `{0}`")]
    CborDecodeError(String),

    #[error("cbor encode failed, reason: `{0}`")]
    CborEncodeError(String),

    #[error("ur decode failed, reason: `{0}`")]
    UrDecodeError(String),

    #[error("ur encode failed, reason: `{0}`")]
    UrEncodeError(String),

    #[error("not support this type: `{0}`")]
    NotSupportURTypeError(String),

    #[error("not a ur")]
    NotAUr,

    #[error("not specified type")]
    TypeUnspecified,

    #[error("protobuf decode failed, reason: `{0}`")]
    ProtobufDecodeError(String),

    #[error("protobuf encode failed, reason: `{0}`")]
    ProtobufEncodeError(String),

    #[error("gzip decode failed, reason: `{0}`")]
    GzipDecodeError(String),

    #[error("gzip encode failed, reason: `{0}`")]
    GzipEncodeError(String),
}

pub type URResult<T> = Result<T, URError>;