Yes, default values do fix this problem as well since it is now a string and
not an empty-sequence.

On Fri, Apr 2, 2010 at 3:09 PM, Ruth Stryker <ruth.stry...@marklogic.com>wrote:

>  Maybe specify a default value in the call to xdmp:get-request-field:
>
>
>
> let $var := xdmp:get-request-field("non-existent-param","")
>
>
>
> (forwarded from another developer)
>
>
>
> *From:* general-boun...@developer.marklogic.com [mailto:
> general-boun...@developer.marklogic.com] *On Behalf Of *spig
> *Sent:* Friday, April 02, 2010 2:01 PM
> *To:* General Mark Logic Developer Discussion
> *Subject:* Re: [MarkLogic Dev General] Unexpected behavior
>
>
>
> The point is that the function is never called (it is throwing fn:error
> just to prove that it's not called, errors or not). Also, there is no
> warning that the function is not being called, or that there is an error in
> the parameter. Anyone know why this is? Try running the code and you'll see
> what I mean. It's almost like there is a hidden try/catch around my code -
> no errors raised and doesn't show that nothing was called.
>
> Steve
>
> On Fri, Apr 2, 2010 at 2:55 PM, Ruth Stryker <ruth.stry...@marklogic.com>
> wrote:
>
> Hi spig,
>
>
>
> Not sure about fn:error(). Maybe approach with try get instead…?
>
>
>
> try {
>  1 div 0
> }
> catch ($e) {
>  $e
> }
>
> Or just use an if then else for checking if your field exists…?
>
>
>
> if(xdmp:get-request-field("q"))
>
>          then local:search-results()
>
>          else …
>
>
>
>
>
>
>
> *From:* general-boun...@developer.marklogic.com [mailto:
> general-boun...@developer.marklogic.com] *On Behalf Of *spig
> *Sent:* Friday, April 02, 2010 1:43 PM
> *To:* general@developer.marklogic.com
> *Subject:* [MarkLogic Dev General] Unexpected behavior
>
>
>
> If I run the following code, my function is never called and no errors are
> raised. Any ideas?
>
>
> xquery version "1.0-ml";
>
> declare function local:test($param1 as xs:string, $param2 as xs:string,
> $param3 as xs:string) {
>   fn:error()
> };
>
> let $var := xdmp:get-request-field("non-existent-param")
>
> let $blah := local:test("", "", $var)
>
> return "Function Call Successful"
>
>
>
> Thanks,
> Steve Spigarelli
>
>
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general
>
>
>
> _______________________________________________
> General mailing list
> General@developer.marklogic.com
> http://xqzone.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
General@developer.marklogic.com
http://xqzone.com/mailman/listinfo/general

Reply via email to