fusesoc icon indicating copy to clipboard operation
fusesoc copied to clipboard

CAPI2 parsing: Always include file and line of parsed file in errors

Open imphil opened this issue 5 years ago • 1 comments

Currently capi2/core.py throws many SyntaxErrors without indicating the exact source location this error comes from. You can guess the file typically by enabling more verbose logging, but that's non-ideal nonetheless.

We should improve the SyntaxError calls by setting at least the filename, and where possible the source line, and report this as part of the error message. It looks like there are appropriate attributes on this exception class which we can use, otherwise we need to extend the class with a fusesoc specific one.

imphil avatar May 08 '19 10:05 imphil

I agree and I have tried to improve this a couple of times. IIRC there are some that are a bit more tricky since they don't have the context of which core they operate on but I can't recall the details now. In any case, improved error messages are very welcome

olofk avatar May 08 '19 12:05 olofk