Vala: hello.vala

This commit is contained in:
Kolan Sh 2012-10-02 15:03:48 +04:00
parent 564171af02
commit 1a6b9cdab6
1 changed files with 4 additions and 0 deletions

View File

@ -13,6 +13,7 @@ public class MyClass : GLib.Object
public static void myfunc_throw() throws ErrType01, ErrType02 public static void myfunc_throw() throws ErrType01, ErrType02
{ {
throw new ErrType01.ERROR_CODE_01( "Ошибка с кодом 01" ); throw new ErrType01.ERROR_CODE_01( "Ошибка с кодом 01" );
// throw new ErrType02.ERROR_TYPE_02( "Ошибка с типом 02" );
} }
public static void myfunc_catch() throws ErrType02 public static void myfunc_catch() throws ErrType02
@ -24,10 +25,12 @@ public class MyClass : GLib.Object
catch( ErrType01 e ) catch( ErrType01 e )
{ {
// Здесь обрабатываются ошибки из домена ErrType01 // Здесь обрабатываются ошибки из домена ErrType01
stdout.printf ("ERR: %s\n", e.message);
} }
finally finally
{ {
// Освобождение ресурсов и прочие необходимые операции // Освобождение ресурсов и прочие необходимые операции
stdout.printf ("Освобождение ресурсов и прочие необходимые операции.\n");
} }
} }
@ -40,6 +43,7 @@ public class MyClass : GLib.Object
catch( ErrType02 e ) catch( ErrType02 e )
{ {
// Здесь обрабатываются ошибки из домена ErrType02 // Здесь обрабатываются ошибки из домена ErrType02
stdout.printf ("ERR: %s\n", e.message);
} }
return 0; return 0;
} }