#SDK Errors

This package defines the shared error type returned by exporters, processors, and providers.

#Error model

  • AlreadyShutdown: an operation was attempted after shutdown completed
  • Timeout: reserved for timeout-aware implementations; the built-in exporters and providers in this repository do not currently emit it
  • InvalidArgument: reserved for invalid user input; the built-in exporters and providers in this repository do not currently emit it
  • InternalFailure: implementation or runtime failure
  • ExportFailure: exporter-specific failure with exporter name and message

OTelSdkResult is the common Result[Unit, OTelSdkError] alias used throughout the SDK packages.

OTelSdkResult

type OTelSdkResult = Result[Unit, OTelSdkError]

Common result type for operations that succeed with Unit. Spec: https://opentelemetry.io/docs/specs/otel/error-handling/#basic-error-handling-principles

OTelSdkError

pub(all) enum OTelSdkError {
AlreadyShutdown
Timeout(Int)
InvalidArgument(String)
InternalFailure(String)
ExportFailure(String, String)
} derive(Compare, Eq, Hash, ToJson,
Debug
)

Error type shared by SDK providers, processors, and exporters. Spec: https://opentelemetry.io/docs/specs/otel/error-handling/#basic-error-handling-principles

already_shutdown

fn already_shutdown() -> Result[Unit, OTelSdkError]

Convenience helper returning AlreadyShutdown. Spec: https://opentelemetry.io/docs/specs/otel/error-handling/#basic-error-handling-principles

export_failure

fn export_failure(exporter_name : String, message : String) -> Result[Unit, OTelSdkError]

Convenience helper returning ExportFailure. Spec: https://opentelemetry.io/docs/specs/otel/error-handling/#basic-error-handling-principles

internal_failure

fn internal_failure(message : String) -> Result[Unit, OTelSdkError]

Convenience helper returning InternalFailure. Spec: https://opentelemetry.io/docs/specs/otel/error-handling/#basic-error-handling-principles

invalid_argument

fn invalid_argument(message : String) -> Result[Unit, OTelSdkError]

Convenience helper returning InvalidArgument. Spec: https://opentelemetry.io/docs/specs/otel/error-handling/#basic-error-handling-principles
fn ok() -> Result[Unit, OTelSdkError]

Convenience helper returning Ok(()). Spec: https://opentelemetry.io/docs/specs/otel/error-handling/#basic-error-handling-principles

timeout

fn timeout(timeout_millis : Int) -> Result[Unit, OTelSdkError]

Convenience helper returning Timeout. Spec: https://opentelemetry.io/docs/specs/otel/error-handling/#basic-error-handling-principles

Source Files

Powered by MoonBit

Site sourceReport issuePackagesBuild queueSkillsStatistics

© 2026 mooncakes.io