diff options
author | Juerg Billeter <j@bitron.ch> | 2007-07-12 12:36:46 +0000 |
---|---|---|
committer | Jürg Billeter <juergbi@src.gnome.org> | 2007-07-12 12:36:46 +0000 |
commit | d57e56257c80ba961b2524a0cfbbfc0267613307 (patch) | |
tree | c7e5c397ee9dc92ee586a0a68cc23340ac10ac4f /gobject | |
parent | ab1d99cd74f7dbdfd88bb92bc06fb7c747ec111b (diff) | |
download | vala-d57e56257c80ba961b2524a0cfbbfc0267613307.tar.gz |
remove Error out parameters, use exceptions
2007-07-12 Juerg Billeter <j@bitron.ch>
* 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
Diffstat (limited to 'gobject')
-rw-r--r-- | gobject/valaccodecompiler.vala | 29 |
1 files changed, 16 insertions, 13 deletions
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)); - } } } |