From d57e56257c80ba961b2524a0cfbbfc0267613307 Mon Sep 17 00:00:00 2001 From: Juerg Billeter Date: Thu, 12 Jul 2007 12:36:46 +0000 Subject: remove Error out parameters, use exceptions 2007-07-12 Juerg Billeter * ccode/valaccodewriter.vala, gobject/valaccodecompiler.vala, compiler/valacompiler.vala, vapi/glib-2.0.vala, gobject-introspection/gidl.vala, vapigen/valagidlparser.vala, vapigen/valavapigen.vala: remove Error out parameters, use exceptions svn path=/trunk/; revision=352 --- gobject/valaccodecompiler.vala | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) (limited to 'gobject/valaccodecompiler.vala') diff --git a/gobject/valaccodecompiler.vala b/gobject/valaccodecompiler.vala index 9d7e2d1ed..2de7a591d 100644 --- a/gobject/valaccodecompiler.vala +++ b/gobject/valaccodecompiler.vala @@ -49,12 +49,14 @@ public class Vala.CCodeCompiler { } string pkgflags; int exit_status; - Error err = null; - if (!Process.spawn_command_line_sync (pc, out pkgflags, null, ref exit_status, out err)) { - Report.error (null, err.message); - return; - } else if (exit_status != 0) { - Report.error (null, "pkg-config exited with status %d".printf (exit_status)); + try { + Process.spawn_command_line_sync (pc, out pkgflags, null, out exit_status); + if (exit_status != 0) { + Report.error (null, "pkg-config exited with status %d".printf (exit_status)); + return; + } + } catch (SpawnError e) { + Report.error (null, e.message); return; } @@ -80,7 +82,14 @@ public class Vala.CCodeCompiler { } } - bool success = Process.spawn_command_line_sync (cmdline, null, null, ref exit_status, out err); + try { + Process.spawn_command_line_sync (cmdline, null, null, out exit_status); + if (exit_status != 0) { + Report.error (null, "cc exited with status %d".printf (exit_status)); + } + } catch (SpawnError e) { + Report.error (null, e.message); + } /* remove generated C source and header files */ foreach (SourceFile file in source_files) { @@ -89,11 +98,5 @@ public class Vala.CCodeCompiler { FileUtils.unlink (file.get_cheader_filename ()); } } - - if (!success) { - Report.error (null, err.message); - } else if (exit_status != 0) { - Report.error (null, "cc exited with status %d".printf (exit_status)); - } } } -- cgit v1.2.1