[mw-devel] [Git][arthur/mw][master] duktape: Make backtraces more useful

Andrew Price welshbyte at sucs.org
Thu Jul 20 09:28:38 BST 2017


Andrew Price pushed to branch master at Justin Mitchell / mw


Commits:
9e4be71f by Andrew Price at 2017-07-20T09:23:48+01:00
duktape: Make backtraces more useful

Use duk_pcompile_string_filename() and duk_pcall() instead of
duk_peval() so we get the filename in js backtraces:

  mwjs error: RangeError: execution timeout
      at [anon] (duktape.c:72259) internal
      at fooCmd (.mw-script/mw.js:20) preventsyield

- - - - -


1 changed file:

- src/client/js-duk.c


Changes:

=====================================
src/client/js-duk.c
=====================================
--- a/src/client/js-duk.c
+++ b/src/client/js-duk.c
@@ -678,8 +678,10 @@ int load_jsfile(FILE *f, const char *filename)
 
 	interrupt = 0;
 	start_timeout();
-	/* TODO: Replace with duk_pcompile_string_filename() + duk_pcall() */
-	err = duk_peval_string(ctx, buf);
+	duk_push_string(ctx, filename);
+	err = duk_pcompile_string_filename(ctx, 0, buf);
+	if (err == 0)
+		err = duk_pcall(ctx, 0);
 	clear_timeout();
 
 	if (err != 0)



View it on GitLab: https://projects.sucs.org/arthur/mw/commit/9e4be71fa54d09a17009dd36479231ab13beaee3

---
View it on GitLab: https://projects.sucs.org/arthur/mw/commit/9e4be71fa54d09a17009dd36479231ab13beaee3
You're receiving this email because of your account on projects.sucs.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sucs.org/pipermail/mw-devel/attachments/20170720/faf3b841/attachment-0001.html>


More information about the mw-devel mailing list