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

Improve error message for invalid executors #99

Merged

Conversation

brumhard
Copy link
Contributor

@brumhard brumhard commented May 2, 2023

This is just a minor thing so I thought I might as well open a PR and see what you think.

Problem

Currently, when you use languages for code blocks that are either not handled (e.g. I tried shell instead of sh in the beginning) or for which the executor program (like node for js) is missing you receive an error like:

> mask foo
ERROR: No such file or directory (os error 2)

For me this was kinda misleading when starting to use the tool.

Describe the solution

That's why I added some error mapping which translates it to:

> cargo run -- foo
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target/debug/mask foo`
ERROR: program 'node' for executor 'js' not in PATH

Testing code

The definition that I used for testing is:

## foo

```js
console.log("bar")
```

Other example

For other programs the new error message might look like:

> cargo run -- lel
    Finished dev [unoptimized + debuginfo] target(s) in 0.02s
     Running `target/debug/mask lel`
ERROR: program 'shell' for executor 'shell' not in PATH

which doesn't look great but I still think it's better than the current error.

@brumhard brumhard force-pushed the feature/improve-not-found-error branch from fb97a9b to 0061b87 Compare May 2, 2023 07:20
@jacobdeichert
Copy link
Owner

This is a nice improvement, thanks for adding a test!

I'll merge it now but probably won't make a new release for at least a week.

@jacobdeichert jacobdeichert merged commit 5567ad8 into jacobdeichert:master May 3, 2023
7 checks passed
@brumhard brumhard deleted the feature/improve-not-found-error branch May 3, 2023 05:29
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.

None yet

2 participants