Take a look at https://github.com/marklogic/cq/blob/master/lib-debug.xqy and
d:whereami(). It throws an exception to get the stack info. Try not to call it
too frequently, but error handling should be ok.
-- Mike
On 23 Feb 2012, at 07:53 , Tim Finney wrote:
> Hi All,
>
> Is there a MarkLogic function that gives the current function name as a
> string? I'd like to have such a function so that I can use it for
> writing error messages. E.g.
>
> declare function my:whatever(...) {
> let $allowed := if (...) then fn:true() else fn:false
> return if ($allowed) then (
> ...
> )
> else fn:concat(
> "You can't do that. ",
> "function: ", foo:current-function-name
> )
> }
>
> I could just write the function name in. But sometimes I change the
> function name and forget to change the error message.
>
> Best,
>
> Tim Finney
>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general