run-command icon indicating copy to clipboard operation
run-command copied to clipboard

Improve error message when user provided command contains syntax error

Open mcafaro opened this issue 1 year ago • 0 comments

If you provide a command that contains a syntax error to run-command, you receive an error pointing to a line and column in the temporary run script which the user does not generally have easy access to.

For example:

- name: Run tests
  uses: matlab-actions/run-command@v1
  with:
    command: addpath(genpath("hedcode")), addpath(genpath("tests"), runAllTests

(note the missing parenthesis after addpath(genpath("tests"))

Produces the following error:

{Error: File:
/tmp/run_matlab_command-Bmd8AP/command_fa35c6ea_71e2_47c5_a57f_e0fc19d59292.m
Line: 1 Column: 104
This statement is incomplete.
} 
exit status 1

It is hard for a user to reason about this error message, especially because "command_fa35c6ea_71e2_47c5_a57f_e0fc19d59292.m" is not a file they created or have easy access to.

We should find a way to provide better error messages in these cases.

mcafaro avatar Jan 30 '24 15:01 mcafaro