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

Remove anyhow's backtrace from RPC response #4728

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

eval-exec
Copy link
Collaborator

What problem does this PR solve?

Issue Number: close #4698

Problem Summary:

What is changed and how it works?

  • use remove_backtrace to remove backtrace from error message

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code ci-runs-only: [ quick_checks,linters ]

Side effects

  • None

Release note

Title Only: Include only the PR title in the release note.

@eval-exec eval-exec requested a review from a team as a code owner November 26, 2024 03:39
@eval-exec eval-exec requested review from zhangsoledad and removed request for a team November 26, 2024 03:39
@eval-exec eval-exec marked this pull request as draft November 26, 2024 03:59
@eval-exec eval-exec force-pushed the exec/remove-rpc-backtrace branch 2 times, most recently from 9937739 to 544d4c8 Compare November 26, 2024 07:09
@eval-exec eval-exec marked this pull request as ready for review November 26, 2024 07:10
@eval-exec eval-exec added the b:rpc Break RPC interface label Nov 26, 2024
doitian
doitian previously approved these changes Nov 26, 2024
@doitian doitian added this pull request to the merge queue Nov 26, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Nov 26, 2024
rpc/src/error.rs Outdated
.lines()
.take_while(|line| !line.starts_with("Stack backtrace:"))
.collect();
lines.join("\n")
Copy link
Collaborator

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.

Copy link
Collaborator Author

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.

chenyukang
chenyukang previously approved these changes Nov 26, 2024
rpc/src/error.rs Outdated
///
/// # Returns
/// * A `String` containing the error message without the backtrace.
fn remove_backtrace(err_str: &str) -> String {
Copy link
Member

@quake quake Nov 26, 2024

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,
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
b:rpc Break RPC interface
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RPC send_transaction should not include stack trace in the RPC response
4 participants