Hello.
Is there a way to construct a throwable error instance from an error code?
I want to implement something like this:
void try_run(int err_code) throws GLib.Error {
if (err_code != 0)
throw new GLib.Error (Quark.from_string ("My Error"),
err_code, err_desc (err_code));
}
It would be invoked as follows:
try {
try_run ( one_command ());
try_run ( another_command ());
...
}
except (Error e) {
...
}
This is because I'm wrapping an non-glib API that reports its errors
using return values,
and I want to construct GLib Exceptions from those values.
However, Vala does not allow me to launch plain GLib.Error instances.
How to work around it?
Thanks.
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list