Quantcast

Really strange error

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Really strange error

Jonathan Rowell

Hi,


I have a strange error in eXist :

#eXist build info
project.version=3.0
project.built=20170208065653
scm.branch=develop
scm.revision=acd0c14

(not yet switched to new release) 
with the following function in a module :-

declare function sipp:LegalDate($name,$datebit as xs:string) as xs:boolean {
if(string-length($datebit) ne 8) then
error(xs:QName('sipp:LegalDate'),concat('Field "',$name,'" not 8 characters, value is "',$value,'"'))
else
if(sipp:MustBeNumeric($name,$value,8)) then
true() (: for the moment :)
else
false()
};

$value is not declared, neither locally nor globally and definitely not in any module (name is far too short!). eXide doesn't complain and neither does inspect:inspect-module, but when I test it via a test module :-

declare
%test:args("overdue-date","20170224") %test:assertTrue
%test:args("overdue-date","2017Jan24") %test:assertError('Illegal date format')
function sipp-test:LegalDate($name as xs:string, $datebit as xs:string) as xs:boolean {
sipp:LegalDate($name,$datebit)
};

I get the following error :-

Running "exist_tester:files" (exist_tester) task
>> For sipp-test:CheckDateTime in http://www.JonathanTest.fr/namespaces/tests/sip2-parser err:XPDY0002 It is a dynamic error if evaluation of an expression relies on
some part of the dynamic context that has not been assigned a value. variable '$value' is not set.

William Candillon's xqLint does detect the error (^ [XPST0008] "value": undeclared variable) but not in the module since it is XQuery version 3.1 and uses map constructs.
Only in a test module.

BTW I must praise the test suite system - it does find errors very nicely.

regards

Jonathan












------------------------------------------------------------------------------
Announcing the Oxford Dictionaries API! The API offers world-renowned
dictionary content that is easy and intuitive to access. Sign up for an
account today to start using our lexical data to power your apps and
projects. Get started today and enter our developer competition.
http://sdm.link/oxford
_______________________________________________
Exist-open mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/exist-open
Loading...