-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
12 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,18 @@ | ||
(ns slipway.error | ||
(:require [clojure.tools.logging :as log]) | ||
(:import (java.io Writer) | ||
(java.nio.charset Charset) | ||
(org.eclipse.jetty.server Request) | ||
(org.eclipse.jetty.server.handler ErrorHandler))) | ||
|
||
(defn log-error | ||
[^Request request code message] | ||
(if-let [ex nil ; TODO: where now? (.getAttribute request RequestDispatcher/ERROR_EXCEPTION) | ||
] | ||
(log/errorf ex "server error: %s %s" code message) | ||
[^Request code message cause] | ||
(if cause | ||
(log/errorf cause "server error: %s %s" code message) | ||
(log/errorf "server error: %s %s" code message))) | ||
|
||
(defn handler ^ErrorHandler | ||
[body-fn] | ||
(proxy [ErrorHandler] [] | ||
(writeErrorHtml [^Request request ^Writer writer code ^String message showStacks] | ||
(.write writer ^String (body-fn request code message showStacks))))) | ||
(writeErrorHtml [^Request request ^Writer writer ^Charset charset code ^String message ^Throwable cause show-stacks] | ||
(.write writer ^String (body-fn request charset code message cause show-stacks))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters