Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: nicer error message when mandatory args are missing. (#247)
When running `orb-hil flash` error message looks scary: before: ``` Error: 0: you must provide either rts-path or s3-url Location: hil/src/commands/flash.rs:71 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ⋮ 6 frames hidden ⋮ 7: orb_hil::commands::flash::Flash::run::{{closure}}::h47c7fdaa37681ba9 at /var/home/user/s/orb/software/hil/src/commands/flash.rs:71 8: orb_hil::main::{{closure}}::{{closure}}::h36e7f8c1fcea41b4 at /var/home/user/s/orb/software/hil/src/main.rs:61 9: orb_hil::main::{{closure}}::{{closure}}::h7efb28c6afe652a3 at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/macros/select.rs:557 10: <tokio::future::poll_fn::PollFn<F> as core::future::future::Future>::poll::h2eac7c48b400a86c at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/future/poll_fn.rs:58 11: orb_hil::main::{{closure}}::hd080318d4af69ecf at /var/home/user/s/orb/software/hil/src/main.rs:67 12: <core::pin::Pin<P> as core::future::future::Future>::poll::h3deb3e24bf77cdb1 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/core/src/future/future.rs:123 13: tokio::runtime::park::CachedParkThread::block_on::{{closure}}::h9987587e480f34d7 at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/park.rs:281 14: tokio::runtime::coop::with_budget::h54b07592779aa816 at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/coop.rs:107 15: tokio::runtime::coop::budget::h05bbc6d89074cce0 at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/coop.rs:73 16: tokio::runtime::park::CachedParkThread::block_on::h7a58e96f17efc25c at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/park.rs:281 17: tokio::runtime::context::blocking::BlockingRegionGuard::block_on::hc7718b5beb89be53 at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context/blocking.rs:66 18: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::{{closure}}::h42267b2512734279 at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/mod.rs:87 19: tokio::runtime::context::runtime::enter_runtime::h9b729c0594cd6e2f at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/context/runtime.rs:65 20: tokio::runtime::scheduler::multi_thread::MultiThread::block_on::he4525a3aefaaac61 at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/scheduler/multi_thread/mod.rs:86 21: tokio::runtime::runtime::Runtime::block_on_inner::h2ee3261bdef73ded at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/runtime.rs:363 22: tokio::runtime::runtime::Runtime::block_on::h896961fccd2a6044 at /home/user/.cargo/registry/src/index.crates.io-6f17d22bba15001f/tokio-1.40.0/src/runtime/runtime.rs:333 23: orb_hil::main::h23b26eec6c27f850 at /var/home/user/s/orb/software/hil/src/main.rs:67 24: core::ops::function::FnOnce::call_once::hf4ac9d2d18d88439 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/core/src/ops/function.rs:250 25: std::sys::backtrace::__rust_begin_short_backtrace::hfd91b22746c72256 at /builddir/build/BUILD/rust-1.81.0-build/rustc-1.81.0-src/library/std/src/sys/backtrace.rs:152 ⋮ 15 frames hidden ⋮ Run with COLORBT_SHOW_HIDDEN=1 environment variable to disable frame filtering. Run with RUST_BACKTRACE=full to include source snippets. ``` after: ``` error: the following required arguments were not provided: --s3-url <S3_URL> --rts-path <RTS_PATH> Usage: orb-hil flash --s3-url <S3_URL> --rts-path <RTS_PATH> For more information, try '--help'. ```
- Loading branch information