2
여기 받침대에 포수 인터셉터의 내 첫 번째 시도이다 :간단한 오류 인터셉터를 작성하는 방법은 무엇입니까?
(definterceptorfn catcher []
(interceptor
:error (fn [context error]
{:status 500
:body (->> error .toString (hash-map :error) json/write-str)
:headers {"Content-type" "application/json"}})))
내 코드 (/ 1 0)를 추가하여 테스트 할 수로서, 함수가 호출되는 않지만, 클라이언트가 빈을 얻는다 응답을 맵에 표시하지 않고 상태 200으로 응답합니다. 왜 그런지 궁금합니다. 문맥이 필요한 때
(defroutes routes
[[["/api"
^:interceptors [(body-params/body-params) (catcher) bootstrap/html-body]
...