Very confusing message for err:XQST0045
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\
-------
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://
http://
http://
http://
http://
-------
.
So, indeed, the function "foo" is declared in the default namespace. That is http://
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://
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
- Till Westmann: Approve
- Matthias Brantner: Approve
-
Diff: 79 lines (+14/-5)3 files modifiedsrc/compiler/translator/translator.cpp (+2/-3)
src/diagnostics/diagnostic_en.xml (+9/-1)
src/diagnostics/pregenerated/dict_en.cpp (+3/-1)
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 |
tags: | removed: parser-normalization |
tags: | removed: v2.1 |
Changed in zorba: | |
status: | Fix Committed → Fix Released |