我有一个正在运行的 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/