Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the Error type to allow users to set custom error handlers #551

Merged
merged 3 commits into from
May 13, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions opentelemetry/src/global/error_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,15 @@ pub enum Error {
#[cfg(feature = "trace")]
#[cfg_attr(docsrs, doc(cfg(feature = "trace")))]
#[error(transparent)]
/// Failed to export traces.
Trace(#[from] TraceError),
#[cfg(feature = "metrics")]
#[cfg_attr(docsrs, doc(cfg(feature = "metrics")))]
#[error(transparent)]
/// Failed to export metrics.
LukeMathWalker marked this conversation as resolved.
Show resolved Hide resolved
Metric(#[from] MetricsError),
#[error("{0}")]
/// Other types of failures not covered by the variants above.
Other(String),
}

Expand Down
2 changes: 1 addition & 1 deletion opentelemetry/src/global/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ mod propagation;
#[cfg(feature = "trace")]
mod trace;

pub use error_handler::{handle_error, set_error_handler};
pub use error_handler::{handle_error, set_error_handler, Error};
#[cfg(feature = "metrics")]
#[cfg_attr(docsrs, doc(cfg(feature = "metrics")))]
pub use metrics::{
Expand Down