Hi Danny,

 

Interesting - I tested it with xdmp:document-get and it successfully catches
the error.  I wrap the call to xdmp:document-load in an http application and
feed it the necessary options via an HTTP Post, so the advantage of using
xdmp:document-load is that I can invoke it via HTTP from an XCC app without
having to obtain and then rewrite the content using document-insert.  It
would be much more advantageous if xdmp:document-load trapped the error, but
I suppose I can add a test using xdmp-document-get as a prerequisite just to
trap such errors prior to invoking xdmp:document-load.

 

What would it take for MarkLogic to trap this error in xdmp:document-load?
Is this a bug?

 

Thanks!

 

Tim

 

  _____  

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

 

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>15178358
166571...</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