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

impl Error for TraceCtxError and ParseSpanIdError #13

Closed
wants to merge 2 commits into from

Conversation

Infrasonics
Copy link
Contributor

By implementing std::error::Error it's possible to use them with anyhow for example. Also, from my understanding, it's expected behavior for errors anyway.

I tried to use a shorter, yet still understandable, version of the docstrings for the error messages. If you'd prefer something different, feel free to change or let me know what to put.

Copy link
Contributor

@jfhbrook-at-work jfhbrook-at-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not so sure about the change to telemetry_layer.rs - is this needed? But I'm otherwise down to make these implement Display and Error!

@ericsampson do you think we can release these changes alongside #14 ? Or should these come out in separate releases? They seem like low-risk changes to me. Thoughts?

@@ -237,7 +237,7 @@ where
parent_id: Some(self.trace_ctx_registry.promote_span_id(parent_id)),
initialized_at,
meta: event.metadata(),
service_name: &self.service_name,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This de-reference looks backwards incompatible. Is this change necessary to improve error handling?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jfhbrook-at-work This change is not necessary for the error handling. It's a warning that was only fixed since CI complained about it. I had not thought about backwards-compatibility, so thanks for pointing this out.

As a warning: this same change is also in #12 for the same reason.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the heads up! I'll keep an eye on it.

use TraceCtxError::*;
write!(f, "{}",
match self {
TelemetryLayerNotRegistered => "`TelemetryLayer` is not a registered subscriber of the current Span",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These messages look OK to me, though I'd defer to @chrisdickinson for organizational opinions here.

@jfhbrook-at-work
Copy link
Contributor

Shipped in #14. Thanks!

@Infrasonics Infrasonics deleted the mk_TraceCtxError_Error branch December 27, 2021 23:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants