marklogic - $error :errors is empty? 时如何触发 MarkLogic 错误处理程序

标签 marklogic

我有一个正在运行的 MarkLogic HTTP 服务器,带有自定义错误处理程序。

在我尝试访问的一个特定 URL 上,我将被路由到错误处理程序。并非所有页面都会路由到错误处理程序,因此网站的其余部分正在运行。

但是,这让我感到困惑:我知道我正在命中指定的错误处理程序(由于日志记录),但外部变量 $error:errors 是一个空序列。

以下是在线文档的内容:

The XQuery module can get the HTTP error code and the contents of the HTTP response using the xdmp:get-response-code API. The XQuery module for the error handler also has access to the XQuery stack trace, if there is one; the XQuery stack trace is passed to the module as an external variable with the name $error:errors

因此它承认可能没有堆栈跟踪。

我的问题是 - 如果没有堆栈跟踪,就没有错误(?)。如果没有错误,为什么我会被路由到错误处理程序?我该如何调试这个?

最佳答案

404“找不到页面”错误将发送到自定义错误处理程序。因为它不是代码错误,因此没有错误堆栈,那么在这种情况下,您可能会被发送到错误处理程序而没有堆栈跟踪。

我发现这一点是因为我意识到我的重写器正在将我发送到一个不存在的文件。没有代码或语法错误,但它仍然是一个错误。

关于marklogic - $error :errors is empty? 时如何触发 MarkLogic 错误处理程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35614636/

相关文章:

xml - 给定一系列XML路径,生成XML树结构

xpath - Marklogic - 使用获取属性值的 Xpath

json - extract-document-data 作为 json 输出中的 xml 字符串元素出现

xquery - Marklogic - mem-node-replace 出现问题

marklogic - Marklogic Java 客户端 API 中的 exportListener 是否有压缩选项?

macos - 在 OSX 上自动启动 MarkLogic

javascript - 如何将对象转换为节点

xml - MarkLogic:在 cts:search 中将字符串转换为路径表达式

xquery - Marklogic:使用xquery的字段范围查询和路径范围查询cts函数是什么

marklogic - 与搜索 :suggest 混淆