-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't wrap the handler body in with-mapped-conditions #186
Closed
+36
−36
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -223,35 +223,36 @@ slot values are computed in this :AFTER method." | |
*headers-sent* | ||
(*request* request)) | ||
(unwind-protect | ||
(with-mapped-conditions () | ||
(labels | ||
((report-error-to-client (error &optional backtrace) | ||
(when *log-lisp-errors-p* | ||
(log-message* *lisp-errors-log-level* "~A~@[~%~A~]" error (when *log-lisp-backtraces-p* | ||
backtrace))) | ||
(start-output +http-internal-server-error+ | ||
(acceptor-status-message *acceptor* | ||
+http-internal-server-error+ | ||
:error (princ-to-string error) | ||
:backtrace (princ-to-string backtrace))))) | ||
(multiple-value-bind (contents error backtrace) | ||
;; skip dispatch if bad request | ||
(when (eql (return-code *reply*) +http-ok+) | ||
(catch 'handler-done | ||
(handle-request *acceptor* *request*))) | ||
(when error | ||
;; error occurred in request handler | ||
(report-error-to-client error backtrace)) | ||
(unless *headers-sent* | ||
(handler-case | ||
(with-debugger | ||
(start-output (return-code *reply*) | ||
(or contents | ||
(acceptor-status-message *acceptor* | ||
(return-code *reply*))))) | ||
(error (e) | ||
;; error occurred while writing to the client. attempt to report. | ||
(report-error-to-client e))))))) | ||
(labels | ||
((report-error-to-client (error &optional backtrace) | ||
(when *log-lisp-errors-p* | ||
(log-message* *lisp-errors-log-level* "~A~@[~%~A~]" error (when *log-lisp-backtraces-p* | ||
backtrace))) | ||
(start-output +http-internal-server-error+ | ||
(acceptor-status-message *acceptor* | ||
+http-internal-server-error+ | ||
:error (princ-to-string error) | ||
:backtrace (princ-to-string backtrace))))) | ||
(multiple-value-bind (contents error backtrace) | ||
;; skip dispatch if bad request | ||
(when (eql (return-code *reply*) +http-ok+) | ||
(catch 'handler-done | ||
(handle-request *acceptor* *request*))) | ||
(when error | ||
;; error occurred in request handler | ||
(with-mapped-conditions () | ||
(report-error-to-client error backtrace))) | ||
(unless *headers-sent* | ||
(with-mapped-conditions () | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ... and here |
||
(handler-case | ||
(with-debugger | ||
(start-output (return-code *reply*) | ||
(or contents | ||
(acceptor-status-message *acceptor* | ||
(return-code *reply*))))) | ||
(error (e) | ||
;; error occurred while writing to the client. attempt to report. | ||
(report-error-to-client e))))))) | ||
(dolist (path *tmp-files*) | ||
(when (and (pathnamep path) (probe-file path)) | ||
;; the handler may have chosen to (re)move the uploaded | ||
|
@@ -271,8 +272,8 @@ alist or NIL if there was no data or the data could not be parsed." | |
(let* ((content-length (header-in :content-length request)) | ||
(content-stream (make-flexi-stream (content-stream request) | ||
:external-format +latin-1+ | ||
:bound (if content-length | ||
(parse-integer content-length | ||
:bound (if content-length | ||
(parse-integer content-length | ||
:junk-allowed t))))) | ||
(prog1 | ||
(parse-rfc2388-form-data content-stream (header-in :content-type request) external-format) | ||
|
@@ -326,8 +327,8 @@ unknown character set ~A in request content type." | |
external-format)) | ||
((and (string-equal type "multipart") | ||
(string-equal subtype "form-data") | ||
(if content-length | ||
(plusp (parse-integer content-length | ||
(if content-length | ||
(plusp (parse-integer content-length | ||
:junk-allowed t)) | ||
t)) | ||
(prog1 (parse-multipart-form-data request external-format) | ||
|
@@ -350,7 +351,7 @@ during the request." | |
(setf (slot-value request 'get-parameters) | ||
(form-url-encoded-list-to-alist (split "&" (query-string request)) external-format)) | ||
(values)) | ||
|
||
(defun script-name* (&optional (request *request*)) | ||
"Returns the file name of the REQUEST object REQUEST. That's the | ||
requested URI without the query string \(i.e the GET parameters)." | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I brought back the with-mapped-conditions here...