I may be wrong, but I think you need to wrap the $err:code in db:output():
see http://docs.basex.org/wiki/XQuery_Update#Returning_Results

Tim

--
Tim A. Thompson
Metadata Librarian (Spanish/Portuguese Specialty)
Princeton University Library


On Fri, Oct 16, 2015 at 10:28 AM, Hondros, Constantine (ELS-AMS) <
[email protected]> wrote:

> Hmm, it is surprisingly hard to get some useful logging information out of
> this.
>
>
>
> Here for example I fall foul of a XQuery syntax here: “all expressions
> must be updating or return an empty sequence. ”
>
>
>
> for $zip in file:list($hm)
>
> return  try {
>
>                     db:add("myDB", $hm || '\' || $zip, "", map {
> 'intparse': true() })
>
>                 } catch * {
>
>                     $err:code
>
>                 }
>
>
>
> Can anyone help me rephrase this so when BaseX halts on a bad zipfile, I
> at least know what the name of the zipfile is?
>
>
>
> C.
>
>
>
>
>
> *From:* Alexander Holupirek [mailto:[email protected]]
> *Sent:* 16 October 2015 15:23
> *To:* Hondros, Constantine (ELS-AMS)
> *Cc:* BaseX
> *Subject:* Re: [basex-talk] Which zip did BaseX choke on?
>
>
>
> Have you tried using try/catch?
>
>
>
> for zip in zips return try { unzip() } catch ...
>
>
> Am 16.10.2015 um 15:16 schrieb Hondros, Constantine (ELS-AMS) <
> [email protected]>:
>
> I love BaseX for the simplicity it brings to XML handling. But this is a
> problem I have not encountered before.
>
>
>
> I am creating a DB from about 17,000 small zipfiles, each containing a
> directory structure and somewhere within each, some XML. BaseX chokes on
> one of these files giving the error:  “invalid entry size (expected 0 but
> got 11083 bytes)”.
>
>
>
> So clearly one or more of the zips is invalid -  but which one(s)?
>
>
>
> Is there any way that BaseX can echo to me the file that is causing the
> error? DEBUG is set to TRUE, but I don’t get any morer verbose output. I am
> using the GUI, and running a BSX script too.
>
>
>
> Thanks in advance,
>
> C.
>
>
> ------------------------------
>
> Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The
> Netherlands, Registration No. 33156677, Registered in The Netherlands.
>
>
> ------------------------------
>
> Elsevier B.V. Registered Office: Radarweg 29, 1043 NX Amsterdam, The
> Netherlands, Registration No. 33156677, Registered in The Netherlands.
>

Reply via email to