regal icon indicating copy to clipboard operation
regal copied to clipboard

Figure out how to best display errors

Open anderseknert opened this issue 1 year ago • 2 comments

We're doing a lot of wrapping around errors in Regal, and I think that's good for providing context and trace capabilities. It however leads to some error messages being printed in a way that's not really friendly to an end-user. Example:

$ regal lint foobar
error(s) ecountered while linting: failed to filter ignored files: failed to filter paths: 1 error occurred during loading: stat foobar: no such file or directory

The above error would be better presented as just:

$ regal lint foobar
foobar: no such file or directory

Or perhaps (and optionally, perhaps when provided the future --debug flag) with something that at least presented each "step" of wrapping:

$ regal lint foobar
error(s) ecountered while linting:
    failed to filter ignored files: 
        failed to filter paths: 1 error occurred during loading:
            stat foobar: no such file or directory

I'm sure there are libraries out there to deal with this, so maybe look into that.

anderseknert avatar Aug 23 '23 13:08 anderseknert