-
Notifications
You must be signed in to change notification settings - Fork 19
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
Conversation
There was a problem hiding this 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, |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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.
Shipped in #14. Thanks! |
By implementing
std::error::Error
it's possible to use them withanyhow
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.