-
Notifications
You must be signed in to change notification settings - Fork 232
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
Remove anyhow's backtrace from RPC response #4728
base: develop
Are you sure you want to change the base?
Remove anyhow's backtrace from RPC response #4728
Conversation
6c7a896
to
e11f007
Compare
9937739
to
544d4c8
Compare
544d4c8
to
677ce79
Compare
rpc/src/error.rs
Outdated
.lines() | ||
.take_while(|line| !line.starts_with("Stack backtrace:")) | ||
.collect(); | ||
lines.join("\n") |
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.
seems there will be an empty extra new line.
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.
Yes, that's true, but it's not a big deal.
rpc/src/error.rs
Outdated
/// | ||
/// # Returns | ||
/// * A `String` containing the error message without the backtrace. | ||
fn remove_backtrace(err_str: &str) -> String { |
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.
suggest to use find and return slice
fn remove_backtrace(err_str: &str) -> &str {
match err_str.find("\nStack backtrace:") {
Some(idx) => &err_str[..idx],
None => err_str,
}
}
677ce79
to
58df314
Compare
Signed-off-by: Eval EXEC <[email protected]>
58df314
to
2ae41ff
Compare
What problem does this PR solve?
Issue Number: close #4698
Problem Summary:
What is changed and how it works?
Check List
Tests
Side effects
Release note