如何防止粘液在某些错误上启动sldb?

Mik*_*nov 4 emacs sbcl common-lisp slime hunchentoot

从连接Slime的Clack/Hunchentoot提供大文件时,我有时会看到错误消息,如SB-IMPL :: SIMPLE-STREAM-PERROR"无法写入~s"......这些是由浏览器过早掉线造成的(这完全可以).问题是,每次发生时,SLDB都会弹出.这很烦人.

有没有办法可以抑制SLDB中的某些错误,如上所述?我仍然希望在错误日志中看到它们,但绝对不是在SLDB中.

Eli*_*son 5

您可以PROCESS-CONNECTION为您的接受器创建子类,并为此错误执行自己的错误处理.

让我们从定义自定义接受器开始:

(defclass no-error-acceptor (hunchentoot:acceptor)
  ())
Run Code Online (Sandbox Code Playgroud)

然后我们可以创建一个包装器PROCESS-CONNECTION来禁止为此特定错误打印消息:

(defmethod hunchentoot:process-connection ((acceptor no-error-acceptor) (socket t))
  (handler-case
      (call-next-method)
    (sb-impl::simple-stream-perror (condition)
      ;; Perhaps log the error here?
      nil)))
Run Code Online (Sandbox Code Playgroud)

确保使用此接受器实际启动服务器以便使用它.