[Vala] try...finally misbehaving
- From: Frederik <scumm_fredo gmx net>
- To: vala-list gnome org
- Subject: [Vala] try...finally misbehaving
- Date: Mon, 19 May 2008 02:56:47 +0200
try...finally doesn't seem to work correct when they are used without
catch clause:
try {
// Open resources
// Error happens and get swallowed here instead of propagated
// after doing finally block
...
} finally {
// Clean up resources
}
---------
using GLib;
public static class TryFinallyTest {
private static void method () throws Error {
try {
print ("before exception\n");
throw new Error (Quark.from_string ("quark"), 42, "generated exception");
print ("after exception\n");
} finally {
print ("doing finally block\n");
}
}
public static int main (string[] args) {
try {
method ();
print ("returned without exception\n");
} catch (Error e) {
print ("returned with exception\n");
}
return 0;
}
}
result:
-------
before exception
** (process:17924): CRITICAL **: file try-finally-test.c: line 20:
uncaught error: generated exception
after exception
doing finally block
returned without exception
expected:
---------
before exception
doing finally block
returned with exception
Regards,
Frederik
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]