Skip to content

Commit

Permalink
config: enable customization of behaviour upon an error condition
Browse files Browse the repository at this point in the history
  • Loading branch information
nagisa committed Jan 6, 2024
1 parent 17122ae commit bb60392
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions tracing-tracy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ impl<C: Config> TracyLayer<C> {
while !data.is_char_boundary(max_len) {
max_len -= 1;
}
self.client
.color_message(error_msg, 0xFF000000, self.config.stack_depth());
self.config.on_error(&self.client, error_msg);
&data[..max_len]
} else {
data
Expand Down Expand Up @@ -298,19 +297,17 @@ where

if let Some((span, span_id)) = stack_frame {
if id.into_u64() != span_id {
self.client.color_message(
self.config.on_error(
&self.client,
"Tracing spans exited out of order! \
Trace may not be accurate for this span stack.",
0xFF000000,
self.config.stack_depth(),
Trace might not be accurate for this span stack.",
);
}
drop(span);
} else {
self.client.color_message(
self.config.on_error(
&self.client,
"Exiting a tracing span, but got nothing on the tracy span stack!",
0xFF000000,
self.config.stack_depth(),
);
}
}
Expand Down

0 comments on commit bb60392

Please sign in to comment.