47 lines
881 B
Vala
47 lines
881 B
Vala
|
public errordomain ErrType01
|
|||
|
{
|
|||
|
ERROR_CODE_01
|
|||
|
}
|
|||
|
|
|||
|
public errordomain ErrType02
|
|||
|
{
|
|||
|
ERROR_TYPE_02
|
|||
|
}
|
|||
|
|
|||
|
public class MyClass : GLib.Object
|
|||
|
{
|
|||
|
public static void myfunc_throw() throws ErrType01, ErrType02
|
|||
|
{
|
|||
|
throw new ErrType01.ERROR_CODE_01( "Ошибка с кодом 01" );
|
|||
|
}
|
|||
|
|
|||
|
public static void myfunc_catch() throws ErrType02
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
myfunc_throw();
|
|||
|
}
|
|||
|
catch( ErrType01 e )
|
|||
|
{
|
|||
|
// Здесь обрабатываются ошибки из домена ErrType01
|
|||
|
}
|
|||
|
finally
|
|||
|
{
|
|||
|
// Освобождение ресурсов и прочие необходимые операции
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
public static int main( string[] args )
|
|||
|
{
|
|||
|
try
|
|||
|
{
|
|||
|
myfunc_catch();
|
|||
|
}
|
|||
|
catch( ErrType02 e )
|
|||
|
{
|
|||
|
// Здесь обрабатываются ошибки из домена ErrType02
|
|||
|
}
|
|||
|
return 0;
|
|||
|
}
|
|||
|
}
|