As far as I can make out, the error builtin function provides a way for recipes to bail out with a message if some pre-conditions are not met. When used, the message given to the user suggests the error function failed rather than the surrounding recipe.
Example (very contrived) justfile
demo arg:
{{ if arg == "foo" { error("arg cannot be 'foo'") } else { arg } }}
other:
mkdir /cant/make/root/directories
Running this as just demo foo, gives the output
error: call to function `error` failed: arg cannot be 'foo'
——▶ justfile:5:28
│
5 │ {{ if arg == "foo" { error("arg cannot be 'foo'") } else { arg } }}
│ ^^^^^
Both the "call to function `error` failed" and the code snippet make the error look like it was at a lower level than it was.
Would it be possible to make the error more similar to other recipe errors
error: recipe `demo` failed on line 5: arg cannot be 'foo'
to match the other recipe from the above example
mkdir /cant/make/root/directories
mkdir: cannot create directory ‘/cant/make/root/directories’: No such file or directory
error: recipe `other` failed on line 9 with exit code 1
As far as I can make out, the
errorbuiltin function provides a way for recipes to bail out with a message if some pre-conditions are not met. When used, the message given to the user suggests theerrorfunction failed rather than the surrounding recipe.Example (very contrived) justfile
Running this as
just demo foo, gives the outputBoth the "call to function `error` failed" and the code snippet make the error look like it was at a lower level than it was.
Would it be possible to make the error more similar to other recipe errors
to match the
otherrecipe from the above example