Very confusing message for err:XQST0045

Bug #867209 reported by Gabriel Petrovay
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zorba
Fix Released
Medium
Matthias Brantner

Bug Description

Query:
--------------------------------
declare function foo() {
};
1
--------------------------------

Error:
--------------------------------
<d:\mm.xq>:1,9: static error [err:XQST0045]: "foo": invalid function or annotation namespace; raised at zorba\src\compiler\translator\translator.cpp:31 26
--------------------------------

It took me a few minutes to determine what is wrong on this query based on the error message.

Spec:
--------------------------------
err:XQST0045
It is a static error if the function name in a function declaration is in one of the following namespaces:
  http://www.w3.org/XML/1998/namespace,
  http://www.w3.org/2001/XMLSchema,
  http://www.w3.org/2001/XMLSchema-instance,
  http://www.w3.org/2005/xpath-functions,
  http://www.w3.org/2005/xpath-functions/math.
--------------------------------
.

So, indeed, the function "foo" is declared in the default namespace. That is http://www.w3.org/2005/xpath-functions is no default namespace declaration is present.

But the error message says:
  "foo": invalid function or annotation namespace

With only that [almost] everybody understands that the "foo" is the wrong "function namespace".

Therefore the understandable error message would be:
  function "foo" is declared in a reserved namespace: http://www.w3.org/2005/xpath-functions/math"

That would make this error's general message look like:
  %1 "%2" is declared in a reserved namespace: %3.%4"

%1 - annotation/function
%2 - QName
%3 - URI (*only* one of the err:XQST0045 list)
%4 - optional advice!!!

Fore more user friendliness, PLEASE also add %4. If in main module and default function namespace is fn, %4 is:
 ' Use "local:foo".'

Related branches

Changed in zorba:
milestone: none → 2.8
assignee: nobody (nobody-users) → Matthias Brantner (matthias-brantner)
status: New → In Progress
Changed in zorba:
status: In Progress → Fix Committed
Changed in zorba:
milestone: 2.8 → 2.9
Chris Hillery (ceejatec)
tags: removed: parser-normalization
tags: removed: v2.1
Chris Hillery (ceejatec)
Changed in zorba:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.