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

Display the stack when there is an error #1114

Merged
merged 2 commits into from
Jun 7, 2020
Merged

Conversation

RobLoach
Copy link
Contributor

@RobLoach RobLoach commented Jun 6, 2020

This isn't really that pretty, but does display the lineNumber.... References #1113

Screenshot at 2020-06-06 15-16-45

Alternatively, we could get the linenumber by using....

              // If thrown is a valid error message, retrieve the stack for it.
              if(duk_is_error(duk, -1) == 1)
              {
                duk_get_prop_string(duk, -1, "lineNumber");
                machine->data->error(machine->data->data, duk_safe_to_string(duk, -1));
                duk_pop(duk);
              } else {
                machine->data->error(machine->data->data, duk_safe_to_string(duk, -1));
              }

We would have to make sure we have the error message in there too though, which would need some concat strings.

@nesbox nesbox linked an issue Jun 7, 2020 that may be closed by this pull request
Copy link
Owner

@nesbox nesbox left a comment

Choose a reason for hiding this comment

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

great. thank you

@nesbox nesbox merged commit 0f4b60f into nesbox:master Jun 7, 2020
@nesbox nesbox added the API Issues related to TIC80 API label Jun 7, 2020
@nesbox nesbox added this to the 0.80.0 milestone Jun 7, 2020
@nesbox nesbox removed this from the 0.80.0 milestone Jul 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Issues related to TIC80 API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Print error trace in JavaScript
2 participants