-
Notifications
You must be signed in to change notification settings - Fork 5
Description
When JS calls native functions but passes incorrect arguments how strict should the bindings be?
example:
const window = new Gtk.Window();
window.setTitle("hello"); // valid
window.setTitle(["hello"]); // invalidShould the invalid arguments call result in:
- Do what GJS does and log a warning to
stderrand then do nothing (pretend the function was never called). - Throw a JS error with a message detailing what was expected and what was given.
I'm a fan of the strictness being enforced by option 2 but GJS is lenient in this regard by just logging an error and then not doing the native call.
Personally I think option 1 can lead to harder to solve bugs. While GJS does log a very small stack trace this is not the same as a real uncaught error from the engine itself. It will not trigger tooling around uncaught errors that a nodejs program might have such as process.on('uncaughtException', ...);, and if the program has noisy output if can become very difficult to see the tree from the forest. Clearly i'm biased towards option 2 but this is easy to change so i've created this issue incase someone has some good reasons I may have missed!