Skip to content

Tweak "Cannot convert {x} to a string argument" error in run_external#7434

Merged
rgwood merged 1 commit intonushell:mainfrom
webbedspace:run_external_error_tweak
Dec 11, 2022
Merged

Tweak "Cannot convert {x} to a string argument" error in run_external#7434
rgwood merged 1 commit intonushell:mainfrom
webbedspace:run_external_error_tweak

Conversation

@webbedspace
Copy link
Copy Markdown
Contributor

@webbedspace webbedspace commented Dec 11, 2022

Description

The message arrow is altered to show the external command name in case it wasn't obvious. (See example for an occasion where it is non-obvious).

BEFORE:

〉else if (2mb) > 4mb
Error: nu::shell::external_command (link)

  × External command failed
   ╭─[entry #35:1:1]
 1 │ else if (2mb) > 4mb
   ·           ─┬
   ·            ╰── Cannot convert filesize to a string
   ╰────
  help: All arguments to an external command need to be string-compatible

AFTER:

〉else if (2mb) > 4mb
Error: nu::shell::external_command (link)

  × External command failed
   ╭─[entry #3:1:1]
 1 │ else if (2mb) > 4mb
   ·           ─┬
   ·            ╰── Cannot convert filesize to a string argument for 'else'
   ╰────
  help: All arguments to an external command need to be string-compatible

User-Facing Changes

See above.

Tests + Formatting

Don't forget to add tests that cover your changes.

Make sure you've run and fixed any issues with these commands:

  • cargo fmt --all -- --check to check standard code formatting (cargo fmt --all applies these changes)
  • cargo clippy --workspace -- -D warnings -D clippy::unwrap_used -A clippy::needless_collect to check that you're using the standard code style
  • cargo test --workspace to check that all tests pass

After Submitting

If your PR had any user-facing changes, update the documentation after the PR is merged, if necessary. This will help us keep the docs up to date.

@rgwood rgwood merged commit 9009f68 into nushell:main Dec 11, 2022
@webbedspace webbedspace deleted the run_external_error_tweak branch December 11, 2022 16:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants