ahgilak / deno_gi

Deno port of Gnome libraries (such as Gtk).
https://deno.land/x/deno_gi
32 stars 2 forks source link

Throw invoke errors #12

Closed vixalien closed 10 months ago

vixalien commented 10 months ago

By default, only the message Error invoking method ${methodName} is logged when invoking an error. This PR ~logs~ throws the GLib.Error correctly if an error happened while executing a function.

~I'm creating this as a draft PR because I think the better approach is to throw the GLib.Error (hence interrupting control flow), but I'm still thinking about creating a GLib.Error~ done

vixalien commented 10 months ago

That said, do you think it's a good idea to cache repos, so that require(lib, version) always returns the same exact Object instead of creating new ones each time?

This would allow for overriding methods across all imported repos, for example: GLib.Error.toString would be overridden (maybe in #10) and all errors would be overridden at once.

ahgilak commented 10 months ago

That said, do you think it's a good idea to cache repos, so that require(lib, version) always returns the same exact Object instead of creating new ones each time?

Yeah it's good to cache repos.

ahgilak commented 10 months ago

I rebased it on main. is this ready to merge now?

vixalien commented 10 months ago

Thanks, I just added the code to throw a generic error like Error invoking constructor {name} when a function invocation does not succeed but without an error.

Ready for re-review