qdk icon indicating copy to clipboard operation
qdk copied to clipboard

Improve WASM layer error handling

Open swernli opened this issue 2 years ago • 1 comments

The qsc_wasm layer does not fully handle the errors reported by check_internal, as some information gets lost in translation (secondary labels, help text, etc). In addition, run_internal API currently only supports returning a single error rather than a list, which might not work for errors from passes like extracting entry point. We need to update the error handling to support multiple, detailed errors, and work on the compilation/execution context caching semantics to better provide actionable errors to the user via WASM.

Tasks

    • [x] Include additional info from compiler errors (#194)
    • [ ] Cleanup object vs json diagnostic return, with consistent control character escaping

swernli avatar Apr 12 '23 21:04 swernli

Not sure if was meant to be covered in this issue, but another concern is that errors contain SourceMap offsets which do not get properly mapped to file offsets. The effect can be seen in this example where the runtime error is coming from stdlib, but get show at a random point in the current file.

This is also the root cause of #750 , I think

minestarks avatar Oct 09 '23 22:10 minestarks