using GLib; MainLoop loop; errordomain Problem { ERROR, } async void innerAsync() throws Problem { var x = 5; Idle.add( innerAsync.callback ); yield; if ( x == 5 ) { throw new Problem.ERROR( "problem" ); } } async void runAsync() throws Problem { message( "1" ); Idle.add( runAsync.callback ); yield; try { yield innerAsync(); } catch ( Problem p ) { message( "problem: %s", p.message ); } } void main() { loop = new MainLoop( null, false ); runAsync(); loop.run(); }