Matthias Brantner has proposed merging lp:~matthias-brantner/zorba/bug-fixing 
into lp:zorba.

Requested reviews:
  Markos Zaharioudakis (markos-za)
  Matthias Brantner (matthias-brantner)

For more details, see:
https://code.launchpad.net/~matthias-brantner/zorba/bug-fixing/+merge/80512

improved error message
-- 
https://code.launchpad.net/~matthias-brantner/zorba/bug-fixing/+merge/80512
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'src/compiler/translator/translator.cpp'
--- src/compiler/translator/translator.cpp	2011-10-18 21:29:50 +0000
+++ src/compiler/translator/translator.cpp	2011-10-26 21:37:31 +0000
@@ -1305,11 +1305,25 @@
     if (qname != NULL)
     {
       RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
-      ERROR_PARAMS(qname->getStringValue()));
+      ERROR_PARAMS(
+        qname->getStringValue(),
+        "index",
+        n-1,
+        "multiple of 6"
+      )
+      );
     }
     else
     {
-      RAISE_ERROR_NO_PARAMS(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc);
+      RAISE_ERROR(
+          zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
+          ERROR_PARAMS(
+            "anonymous",
+            "index",
+            n-1,
+            "multiple of 6"
+          )
+      );
     }
   }
 

=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2011-10-17 21:17:05 +0000
+++ src/diagnostics/diagnostic_en.xml	2011-10-26 21:37:31 +0000
@@ -1966,7 +1966,7 @@
     </diagnostic>
 
     <diagnostic code="ZDDY0025" name="INDEX_WRONG_NUMBER_OF_PROBE_ARGS">
-      <value>${"1": }invalid number of arguments in probe</value>
+      <value>"$1": invalid number of arguments to $2 operation; given $3 expected $4</value>
     </diagnostic>
 
     <diagnostic code="ZDDY0026" name="INDEX_RANGE_PROBE_NOT_ALLOWED">

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2011-10-20 23:05:55 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2011-10-26 21:37:31 +0000
@@ -286,7 +286,7 @@
   { "ZDDY0022", "\"$1\": index already exists" },
   { "ZDDY0023", "\"$1\": index does not exist" },
   { "ZDDY0024", "\"$1\": index uniqueness violation" },
-  { "ZDDY0025", "${\"1\": }invalid number of arguments in probe" },
+  { "ZDDY0025", "\"$1\": invalid number of arguments to $2 operation; given $3 expected $4" },
   { "ZDDY0026", "\"$1\": index range probe not allowed" },
   { "ZDDY0027", "\"$1\": index multiple creates" },
   { "ZDDY0028", "\"$1\": index domain has duplicate nodes" },

=== modified file 'src/runtime/indexing/index_ddl.cpp'
--- src/runtime/indexing/index_ddl.cpp	2011-10-05 17:49:48 +0000
+++ src/runtime/indexing/index_ddl.cpp	2011-10-26 21:37:31 +0000
@@ -634,7 +634,12 @@
       if (state->theIndexDecl->getKeyExpressions().size() != numChildren-1)
       {
         RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
-        ERROR_PARAMS(qnameItem->getStringValue()));
+        ERROR_PARAMS(
+          qnameItem->getStringValue(),
+          "index",
+          numChildren-1,
+          state->theIndexDecl->getKeyExpressions().size())
+        );
       }
 
       state->theIndex = (state->theIndexDecl->isTemp() ?
@@ -800,7 +805,12 @@
           numChildren != 2)
       {
         RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
-        ERROR_PARAMS(qnameItem->getStringValue()));
+        ERROR_PARAMS(
+          qnameItem->getStringValue(),
+          "index",
+          numChildren-1,
+          state->theIndexDecl->getKeyExpressions().size())
+        );
       }
 
       state->theIndex = (state->theIndexDecl->isTemp() ?
@@ -973,13 +983,23 @@
     if ((numChildren-1) % 6 != 0)
     {
       RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
-      ERROR_PARAMS(qname->getStringValue()));
+      ERROR_PARAMS(
+        qname->getStringValue(),
+        "index",
+        numChildren-1,
+        "multiple of 6"
+      ));
     }
 
     if (indexDecl->getKeyExpressions().size() * 6 > numChildren-1)
     {
       RAISE_ERROR(zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS, loc,
-      ERROR_PARAMS(qname->getStringValue()));
+      ERROR_PARAMS(
+        qname->getStringValue(),
+        "index",
+        numChildren-1,
+        indexDecl->getKeyExpressions().size() * 6
+      ));
     }
 
     state->theIndex = (indexDecl->isTemp() ?

=== modified file 'src/runtime/store/maps_impl.cpp'
--- src/runtime/store/maps_impl.cpp	2011-08-17 23:04:48 +0000
+++ src/runtime/store/maps_impl.cpp	2011-10-26 21:37:31 +0000
@@ -241,7 +241,11 @@
   {
     throw XQUERY_EXCEPTION(
       zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS,
-      ERROR_PARAMS( lQName->getStringValue() ),
+      ERROR_PARAMS(
+        lQName->getStringValue(),
+        "map",
+        theChildren.size() - 1,
+        lSpec.getNumColumns() ),
       ERROR_LOC( loc )
     );
   }
@@ -316,7 +320,11 @@
   {
     throw XQUERY_EXCEPTION(
       zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS,
-      ERROR_PARAMS( lQName->getStringValue() ),
+      ERROR_PARAMS(
+        lQName->getStringValue(),
+        "map",
+        theChildren.size() - 2,
+        lSpec.getNumColumns() ),
       ERROR_LOC( loc )
     );
   }
@@ -386,7 +394,12 @@
   {
     throw XQUERY_EXCEPTION(
       zerr::ZDDY0025_INDEX_WRONG_NUMBER_OF_PROBE_ARGS,
-      ERROR_PARAMS( lQName->getStringValue() ),
+      ERROR_PARAMS(
+        lQName->getStringValue(),
+        "map",
+        theChildren.size() - 1,
+        lSpec.getNumColumns()
+      ),
       ERROR_LOC( loc )
     );
   }

-- 
Mailing list: https://launchpad.net/~zorba-coders
Post to     : zorba-coders@lists.launchpad.net
Unsubscribe : https://launchpad.net/~zorba-coders
More help   : https://help.launchpad.net/ListHelp

Reply via email to