Hi Tim,

I'm not sure if this will help, but that error appears to be catchable in 
xdmp:document-get, so you should be able to do this using xdmp:document-get 
instead.  The combination of xdmp:document-get + xdmp:document-insert is pretty 
much the same as xdmp:document-load.

-Danny

From: [email protected] 
[mailto:[email protected]] On Behalf Of Tim Meagher
Sent: Tuesday, July 06, 2010 12:57 PM
To: 'General Mark Logic Developer Discussion'
Subject: [MarkLogic Dev General] try-catch block seemingly not working with 
xdmp:document-load() error

Hi Folks,

I wrapped an xdmp:document-load() in a try-catch block but it doesn't catch the 
error and allow me to take corrective action.

I experimented with it in cq and still get an error, for example, given the 
following query:

try {

let $uri := "/base-uri/docname.xml"

let $url := "http://[server]/[docpath]/docname.xml";
let $options :=
  <options xmlns="xdmp:document-load" >
    <uri>{$uri}</uri>
</options>

let $properties :=
  <properties>
    <datetime>2010-07-06-04:00</datetime>
  </properties>

return xdmp:document-load($url, $options)
}

catch($e) {
  "Problem loading file, received the following exception: ", $e
}


The result is as follows:
query evaluated in fabrication at Modules:/ as 1.0-ml (cq v4.1-1)
[1.0-ml] XDMP-DOCUTF8SEQ: xdmp:eval("try {&#13;&#10;&#13;&#10;let $uri := 
&quot:/base-uri/...", (), <options 
xmlns="xdmp:eval"><database>10474121819804666683</database><modules>15178358166571...</options>)
 -- Invalid UTF-8 escape sequence at http://[server]/[docpath]/docname.xml line 
68 -- document is not UTF-8 encoded
Stack trace:
in /eval.xqy line 111:
I expected the error to begin with: "Problem loading file, received the 
following exception: "
Tim Meagher
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to