Improve error messages, fix naming bug and assignment bug in native #362
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes source-academy/frontend#963
When js functions throw their own errors (e.g. head(xs) will throw if xs is not a pair), it gets wrapped in an ExceptionError. If these functions are nested down, they each get wrapped in their own ExceptionError, causing the [object Object] error message.
Now, we check whether the error has already been wrapped before wrapping the error.
This also improves many of the Line -1 messages that occur.
This also fixes the bug here: https://sourceacademy.nus.edu.sg/playground#chap=3&exec=1000&ext=NONE&prgrm=GYVwdgxgLglg9mABAdwE4EMAOAKAlIgbwChFTEiBfIA
and the bug here:
https://sourceacademy.nus.edu.sg/playground#chap=3&exec=1000&ext=NONE&prgrm=DYUwLgBAhhC8EAcoEsBOBuAUDeS3qA