Re: [Vala] Introspection for exception instances
- From: Michael Gratton <mike vee net>
- To: Al Thomas <astavale yahoo co uk>
- Cc: Vala <vala-list gnome org>
- Subject: Re: [Vala] Introspection for exception instances
- Date: Fri, 17 Nov 2017 09:45:07 +1100
Hey Al,
On Tue, Nov 14, 2017 at 3:09 AM, Al Thomas <astavale yahoo co uk> wrote:
I hope this gets you a step further, but I've not applied this with
GLib's cancellable.
The general pattern is:
void main () {
try {
test ();
} catch (IOError error) {
print (error.message + "\n");
}
}
void test () throws IOError {
throw new IOError.CANCELLED ("This test has been cancelled");
}
Just compile with valac --pkg gio-2.0 cancellable_error.vala and you
will see
the message.
Yeah, that will get me the message which is great, but I'm interested
in the developer-readable string version of the domain and code.
So for example being able to call `error.to_string()` and get
"IOError.CANCELLED: This test has been cancelled" returned would be
good, but it would be even better to be able to get the individual
components, e.g. "IOError" and "CANCELLED".
I assumed CANCELLABLE was a typo.
Yeah sure was, sorry. I need a type-checker for my email composer.
//Mike
--
⊨ Michael Gratton, Percept Wrangler.
⚙ <http://mjog.vee.net/>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]