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

Allow for cleaner output messages when forking origin ID is not valid #7243

Closed
Tracked by #8269
AbhinavMir opened this issue Feb 26, 2024 · 1 comment
Closed
Tracked by #8269
Labels
C-anvil Command: anvil T-feature Type: feature

Comments

@AbhinavMir
Copy link

Component

Anvil

Describe the feature you would like

Currently, a bad command like anvil --fork-url https://mainnet.infura.io/v3/INVALID_CODE will result in

thread 'main' panicked at /home/runner/work/foundry/foundry/crates/anvil/src/config.rs:951:57:
Failed to get fork block number: DeserError { err: Error("expected value", line: 1, column: 1), text: "invalid project id\n" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
[1]    74091 IOT instruction (core dumped)  anvil --fork-url https://mainnet.infura.io/v3/INVALID_CODE
Time taken: 1 seconds         

A panic is rather hard for a non-Rust user to parse in a glance. A better message would probably be Fork error: Bad source URL or something of that kind.

Another side request, which I'm not sure of, is checking via regex is a URL during fork is valid (i.e of the form http://xyz.abc/)

Happy to take this up.

Additional context

No response

@zerosnacks
Copy link
Member

zerosnacks commented Jul 11, 2024

Hi @AbhinavMir thanks for your suggestion,

I think a panic in this case is appropriate and the resulting error is highly dependent on the context

Marking as not planned

@zerosnacks zerosnacks closed this as not planned Won't fix, can't repro, duplicate, stale Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-anvil Command: anvil T-feature Type: feature
Projects
None yet
Development

No branches or pull requests

2 participants