Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix error messages from backends #86

Merged
merged 24 commits into from
Mar 20, 2024
Merged

Fix error messages from backends #86

merged 24 commits into from
Mar 20, 2024

Conversation

presenthee
Copy link
Collaborator

This PR handles #73.

Main Changes:

  • Added Error module and put Source.error functions to util/error.ml.
  • Cleaned up failure related to values into functions in al_util.
  • Avoided overusing failwith in backends. Use Error.error if possible.
  • Changed error messages to be more useful by adding detailed explanations.

Changes specific to the backend-interpreter:
For AL-level debugging, new exceptions were added.

  • Backend_interpreter.Exception.Error is raised when there is an exception while stepping an instruction. (by try_step_wasm, try_step_instr)
  • Backend_interpreter.Exception.Error contains step(instruction), line and al function name information. These are printed with the original exception message.
  • Added other exceptions for indicating unexpected error related to calling functions or construction of value.

Copy link
Collaborator

@rossberg rossberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good. I added a few comments where the message possibly is rather opaque for end users.

spectec/src/exe-watsup/main.ml Outdated Show resolved Hide resolved
spectec/src/il2al/il2il.ml Outdated Show resolved Hide resolved
spectec/src/il2al/il2il.ml Outdated Show resolved Hide resolved
spectec/src/il2al/translate.ml Outdated Show resolved Hide resolved
spectec/src/il2al/translate.ml Outdated Show resolved Hide resolved
spectec/src/il2al/translate.ml Outdated Show resolved Hide resolved
Copy link
Collaborator

@rossberg rossberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

spectec/src/il2al/il2il.ml Outdated Show resolved Hide resolved
@presenthee presenthee merged commit 753f017 into main Mar 20, 2024
5 checks passed
@presenthee presenthee deleted the error-handling branch March 29, 2024 05:19
Alan-Liang pushed a commit to Alan-Liang/spectec that referenced this pull request Oct 3, 2024
* Revert "Allow cont ref to be non-null in switch (Wasm-DSL#85)"

This reverts commit 92cbcc5.

* Remove other unnecessary `null?` in instruction typing
rossberg pushed a commit that referenced this pull request Nov 7, 2024
* Rework IndexValueToU64 to allow more inputs to BigInts

* Address #86 feedback
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants