[glibmm/gmmproc-refactor] More readable errors.



commit c81252dd1acb20556b1623cb05bd1b06bdd11313
Author: Krzesimir Nowak <qdlacz gmail com>
Date:   Thu Jul 12 18:12:42 2012 +0200

    More readable errors.

 tools/pm/Common/Output/Method.pm |   23 ++++++++++++++++++-----
 tools/pm/Common/Output/Shared.pm |   14 +++++++++++++-
 2 files changed, 31 insertions(+), 6 deletions(-)
---
diff --git a/tools/pm/Common/Output/Method.pm b/tools/pm/Common/Output/Method.pm
index e8a1139..6d23a3f 100644
--- a/tools/pm/Common/Output/Method.pm
+++ b/tools/pm/Common/Output/Method.pm
@@ -64,14 +64,27 @@ sub _output_cc ($$$$$$$$$$$$$$$$$)
 
 # TODO: replace with exception throwing
   # if dies then it is internal error. should not happen here.
-  die if ($static and ($const or $constversion));
-  die if (scalar (@{$cxx_param_types}) != scalar(@{$cxx_param_names}));
-  if ($cxx_param_out_index < 0) {
-    die if (scalar (@{$c_param_types}) != scalar(@{$cxx_param_types}));
+  if ($static and ($const or $constversion))
+  {
+    $wrap_parser->fixed_error ('static and const does not mix.');
+  }
+  if (scalar (@{$cxx_param_types}) != scalar(@{$cxx_param_names}))
+  {
+    $wrap_parser->fixed_error ('param types count should be equal to param names count');
+  }
+  if ($cxx_param_out_index < 0)
+  {
+    if (scalar (@{$c_param_types}) != scalar(@{$cxx_param_types}))
+    {
+      $wrap_parser->fixed_error ('C param types count should be equal to C++ param count');
+    }
   }
   else
   {
-    die if (scalar (@{$c_param_types}) + 1 != scalar(@{$cxx_param_types}));
+    if (scalar (@{$c_param_types}) + 1 != scalar(@{$cxx_param_types}))
+    {
+      $wrap_parser->fixed_error ('C param types count should be greater by one from C++ param_types (there is an output parameter.');
+    }
   }
 
   if ($deprecated)
diff --git a/tools/pm/Common/Output/Shared.pm b/tools/pm/Common/Output/Shared.pm
index 4384066..0b8daad 100644
--- a/tools/pm/Common/Output/Shared.pm
+++ b/tools/pm/Common/Output/Shared.pm
@@ -635,7 +635,19 @@ sub convzipstr ($$$$$)
   my $substs_count = @{$substs};
 
 # TODO: throw runtime error or internal error or whatever.
-  die if $from_types_count != $to_types_count or $to_types_count != $transfers_count or $transfers_count != $substs_count;
+  #die if $from_types_count != $to_types_count or $to_types_count != $transfers_count or $transfers_count != $substs_count;
+  if ($from_types_count != $to_types_count)
+  {
+    $wrap_parser->fixed_error ('From types count should be equal to to types count.');
+  }
+  if ($to_types_count != $transfers_count)
+  {
+    $wrap_parser->fixed_error ('To types count should be equal to transfers count.');
+  }
+  if ($transfers_count != $substs_count)
+  {
+    $wrap_parser->fixed_error ('Transfers count should be equal to substs count.');
+  }
 
   my @conversions = ();
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]