The hunchentoot-errors Reference Manual

This is the hunchentoot-errors Reference Manual, version 0.0.1, generated automatically by Declt version 4.0 beta 2 "William Riker" on Wed May 15 05:34:10 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 hunchentoot-errors

Augments Hunchentoot error pages and logs with request and session information

Author

Mariano Montone <>

Home Page

https://github.com/mmontone/hunchentoot-errors

License

MIT

Long Description

# hunchentoot-errors

Augments Hunchentoot error pages and logs with request and session information

## Usage

Subclass your acceptor from ‘HUNCHENTOOT-ERRORS:ERRORS-ACCEPTOR‘.

When ‘hunchentoot:*show-lisp-errors-p*‘ is on, you get HTTP request and session information printed in errors pages and logs, like:

“‘
Backtrace for: #<SB-THREAD:THREAD "hunchentoot-worker-127.0.0.1:46428" RUNNING {1002007DE3}>
0: (TRIVIAL-BACKTRACE:PRINT-BACKTRACE-TO-STREAM #<SB-IMPL::CHARACTER-STRING-OSTREAM {1003C82953}>)
1: ((FLET "FORM-FUN-4" :IN HUNCHENTOOT::GET-BACKTRACE))
2: (HUNCHENTOOT::GET-BACKTRACE)
3: ((FLET "H0" :IN HUNCHENTOOT:HANDLE-REQUEST) #<SIMPLE-ERROR "sdf" {1003C827F3}>)
4: (SB-KERNEL::%SIGNAL #<SIMPLE-ERROR "sdf" {1003C827F3}>)
5: (ERROR "sdf")
6: (INVOICE-ENGINE::ADMIN/USERS/CREATE)
7: ((LAMBDA NIL :IN EASY-ROUTES::PROCESS-ROUTE))
8: (EASY-ROUTES::CALL-WITH-DECORATORS NIL #<CLOSURE (LAMBDA NIL :IN EASY-ROUTES::PROCESS-ROUTE) {1003C7C57B}>)
9: ((LAMBDA NIL :IN EASY-ROUTES::CALL-WITH-DECORATORS))
10: (INVOICE-ENGINE::@SUPERADMIN #<CLOSURE (LAMBDA NIL :IN EASY-ROUTES::CALL-WITH-DECORATORS) {1003C7C59B}>)
11: (EASY-ROUTES::CALL-DECORATOR INVOICE-ENGINE::@SUPERADMIN #<CLOSURE (LAMBDA NIL :IN EASY-ROUTES::CALL-WITH-DECORATORS) {1003C7C59B}>)
12: (EASY-ROUTES::CALL-WITH-DECORATORS (INVOICE-ENGINE::@SUPERADMIN) #<CLOSURE (LAMBDA NIL :IN EASY-ROUTES::PROCESS-ROUTE) {1003C7C57B}>)
13: ((:METHOD EASY-ROUTES::PROCESS-ROUTE (EASY-ROUTES:ROUTE T)) #<EASY-ROUTES:ROUTE ADMIN/USERS/CREATE: POST ("admin" "users" "new") {1007C3AFD3}> NIL) [fast-method]
14: ((:METHOD HUNCHENTOOT:ACCEPTOR-DISPATCH-REQUEST (EASY-ROUTES:EASY-ROUTES-ACCEPTOR T)) #<INVOICE-ENGINE::IE-WEB-ACCEPTOR (host *, port 9090)> #<HUNCHENTOOT:REQUEST {1003C79383}>) [fast-method]
15: ((:METHOD HUNCHENTOOT:HANDLE-REQUEST (HUNCHENTOOT:ACCEPTOR HUNCHENTOOT:REQUEST)) #<INVOICE-ENGINE::IE-WEB-ACCEPTOR (host *, port 9090)> #<HUNCHENTOOT:REQUEST {1003C79383}>) [fast-method]
16: ((:METHOD HUNCHENTOOT:PROCESS-REQUEST (T)) #<HUNCHENTOOT:REQUEST {1003C79383}>) [fast-method]
17: ((SB-PCL::DEFAULT-ONLY HUNCHENTOOT:PROCESS-REQUEST) #<HUNCHENTOOT:REQUEST {1003C79383}>)
18: ((LAMBDA NIL :IN HUNCHENTOOT:PROCESS-CONNECTION))
19: (HUNCHENTOOT::DO-WITH-ACCEPTOR-REQUEST-COUNT-INCREMENTED #<INVOICE-ENGINE::IE-WEB-ACCEPTOR (host *, port 9090)> #<CLOSURE (LAMBDA NIL :IN HUNCHENTOOT:PROCESS-CONNECTION) {1003C788FB}>)
20: ((:METHOD HUNCHENTOOT:PROCESS-CONNECTION (HUNCHENTOOT:ACCEPTOR T)) #<INVOICE-ENGINE::IE-WEB-ACCEPTOR (host *, port 9090)> #<USOCKET:STREAM-USOCKET {1001D1FEC3}>) [fast-method]
21: ((FLET CALL-NEXT-METHOD :IN "/mnt/e6b00b8f-9dad-4bf4-bd40-34b1e6d31f0a/home/marian/quicklisp/dists/quicklisp/software/hunchentoot-v1.2.38/acceptor.lisp"))
22: ((:METHOD HUNCHENTOOT:PROCESS-CONNECTION :AROUND (HUNCHENTOOT:ACCEPTOR T)) #<INVOICE-ENGINE::IE-WEB-ACCEPTOR (host *, port 9090)> #<USOCKET:STREAM-USOCKET {1001D1FEC3}>) [fast-method]
23: ((FLET HUNCHENTOOT::PROCESS-CONNECTION% :IN HUNCHENTOOT::HANDLE-INCOMING-CONNECTION%) #<INVOICE-ENGINE::IE-WEB-ACCEPTOR (host *, port 9090)> #<USOCKET:STREAM-USOCKET {1001D1FEC3}>)
24: ((:METHOD HUNCHENTOOT::HANDLE-INCOMING-CONNECTION% (HUNCHENTOOT:ONE-THREAD-PER-CONNECTION-TASKMASTER T)) #<HUNCHENTOOT:ONE-THREAD-PER-CONNECTION-TASKMASTER {10065EB6E3}> #<USOCKET:STREAM-USOCKET {1001D1FEC3}>) [fast-method]
25: ((LAMBDA NIL :IN HUNCHENTOOT:CREATE-REQUEST-HANDLER-THREAD))
26: ((LAMBDA NIL :IN BORDEAUX-THREADS::BINDING-DEFAULT-SPECIALS))
27: ((FLET SB-UNIX::BODY :IN SB-THREAD::NEW-LISP-THREAD-TRAMPOLINE))
28: ((FLET "WITHOUT-INTERRUPTS-BODY-4" :IN SB-THREAD::NEW-LISP-THREAD-TRAMPOLINE))
29: ((FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::NEW-LISP-THREAD-TRAMPOLINE))
30: ((FLET "WITHOUT-INTERRUPTS-BODY-1" :IN SB-THREAD::CALL-WITH-MUTEX))
31: (SB-THREAD::CALL-WITH-MUTEX #<CLOSURE (FLET SB-THREAD::WITH-MUTEX-THUNK :IN SB-THREAD::NEW-LISP-THREAD-TRAMPOLINE) {7FD95C27ED9B}> #<SB-THREAD:MUTEX "thread result lock" owner: #<SB-THREAD:THREAD "hunchentoot-worker-127.0.0.1:46428" RUNNING {1002007DE3}>> NIL T NIL) 32: (SB-THREAD::NEW-LISP-THREAD-TRAMPOLINE #<SB-THREAD:THREAD "hunchentoot-worker-127.0.0.1:46428" RUNNING {1002007DE3}> NIL #<CLOSURE (LAMBDA NIL :IN BORDEAUX-THREADS::BINDING-DEFAULT-SPECIALS) {1001FF7FBB}> NIL)
33: ("foreign function: call_into_lisp")
34: ("foreign function: new_thread_trampoline")

HTTP REQUEST:
uri: /admin/users/new
method: POST
post parameters:
name: asdf
username: asdf
email: sdf@asdfasdf.com
password: asdfasdf

SESSION:
FLASH-MESSAGES: NIL
ROLE: "superadmin"
USER: 3
FORWARD-URL: "/"
“‘

## License

MIT

Version

0.0.1

Dependencies
  • hunchentoot (system).
  • string-case (system).
  • parse-number (system).
  • cl-mimeparse (system).
Source

hunchentoot-errors.asd.

Child Components

3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 hunchentoot-errors/hunchentoot-errors.asd

Source

hunchentoot-errors.asd.

Parent Component

hunchentoot-errors (system).

ASDF Systems

hunchentoot-errors.


3.1.2 hunchentoot-errors/package.lisp

Source

hunchentoot-errors.asd.

Parent Component

hunchentoot-errors (system).

Packages

hunchentoot-errors.


3.1.3 hunchentoot-errors/errors-acceptor.lisp

Dependency

package.lisp (file).

Source

hunchentoot-errors.asd.

Parent Component

hunchentoot-errors (system).

Public Interface
Internals

3.1.4 hunchentoot-errors/trace-acceptor.lisp

Dependency

errors-acceptor.lisp (file).

Source

hunchentoot-errors.asd.

Parent Component

hunchentoot-errors (system).

Packages

hunchentoot-trace.

Public Interface
Internals

3.1.5 hunchentoot-errors/http-errors.lisp

Dependency

trace-acceptor.lisp (file).

Source

hunchentoot-errors.asd.

Parent Component

hunchentoot-errors (system).

Public Interface

http-error (function).


4 Packages

Packages are listed by definition order.


4.1 hunchentoot-trace

Source

trace-acceptor.lisp.

Use List
  • common-lisp.
  • hunchentoot.
Public Interface
Internals

4.2 hunchentoot-errors

Source

package.lisp.

Use List
  • common-lisp.
  • hunchentoot.
Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *trace-requests*
Package

hunchentoot-trace.

Source

trace-acceptor.lisp.

Special Variable: *trace-session*
Package

hunchentoot-trace.

Source

trace-acceptor.lisp.


5.1.2 Ordinary functions

Function: http-error (http-error &optional result)

Abort current handler and signal HTTP error HTTP-ERROR.

HTTP-ERROR should be an HTTP status code (integer).

Package

hunchentoot-errors.

Source

http-errors.lisp.


5.1.3 Standalone methods

Method: acceptor-log-access ((acceptor trace-acceptor) &key return-code)
Package

hunchentoot.

Source

trace-acceptor.lisp.

Method: acceptor-log-message ((acceptor errors-acceptor) log-level format-string &rest format-arguments)

Sends a formatted message to the destination denoted by (ACCEPTOR-MESSAGE-LOG-DESTINATION ACCEPTOR). FORMAT and ARGS are as in FORMAT.
LOG-LEVEL is a keyword denoting the log level or NIL in which case it is ignored.

Package

hunchentoot.

Source

errors-acceptor.lisp.

Method: acceptor-status-message ((acceptor errors-acceptor) http-status-code &key &allow-other-keys)
Package

hunchentoot.

Source

errors-acceptor.lisp.


5.1.4 Classes

Class: errors-acceptor

Subclasses of this acceptor augment Hunchentoot error pages and logs with request and session information.

Package

hunchentoot-errors.

Source

errors-acceptor.lisp.

Direct superclasses

acceptor.

Direct methods
Direct slots
Slot: log-request

When enabled, request information is written to the log.

Initform

t

Initargs

:log-request

Readers

log-requestp.

Writers

(setf log-requestp).

Slot: debug-request

When enabled, request information is printed in Hunchentoot status error pages.

Initform

t

Initargs

:debug-request

Readers

debug-requestp.

Writers

(setf debug-requestp).

Slot: log-session

When enabled, session information is written to the log.

Initform

t

Initargs

:log-session

Readers

log-sessionp.

Writers

(setf log-sessionp).

Slot: debug-session

When enabled, session information is printed in Hunchentoot status error pages.

Initform

t

Initargs

:debug-session

Readers

debug-sessionp.

Writers

(setf debug-sessionp).

Class: trace-acceptor
Package

hunchentoot-trace.

Source

trace-acceptor.lisp.

Direct superclasses

acceptor.

Direct methods

acceptor-log-access.


5.2 Internals


5.2.1 Ordinary functions

Function: accept-format (&optional content-type)
Package

hunchentoot-errors.

Source

errors-acceptor.lisp.


5.2.2 Generic functions

Generic Function: acceptor-log-error (stream acceptor log-level format-string &rest format-arguments)
Package

hunchentoot-errors.

Source

errors-acceptor.lisp.

Methods
Method: acceptor-log-error (stream (acceptor errors-acceptor) log-level format-string &rest format-arguments)
Generic Reader: debug-requestp (object)
Generic Writer: (setf debug-requestp) (object)
Package

hunchentoot-errors.

Methods
Reader Method: debug-requestp ((errors-acceptor errors-acceptor))
Writer Method: (setf debug-requestp) ((errors-acceptor errors-acceptor))

When enabled, request information is printed in Hunchentoot status error pages.

Source

errors-acceptor.lisp.

Target Slot

debug-request.

Generic Reader: debug-sessionp (object)
Generic Writer: (setf debug-sessionp) (object)
Package

hunchentoot-errors.

Methods
Reader Method: debug-sessionp ((errors-acceptor errors-acceptor))
Writer Method: (setf debug-sessionp) ((errors-acceptor errors-acceptor))

When enabled, session information is printed in Hunchentoot status error pages.

Source

errors-acceptor.lisp.

Target Slot

debug-session.

Generic Reader: log-requestp (object)
Generic Writer: (setf log-requestp) (object)
Package

hunchentoot-errors.

Methods
Reader Method: log-requestp ((errors-acceptor errors-acceptor))
Writer Method: (setf log-requestp) ((errors-acceptor errors-acceptor))

When enabled, request information is written to the log.

Source

errors-acceptor.lisp.

Target Slot

log-request.

Generic Reader: log-sessionp (object)
Generic Writer: (setf log-sessionp) (object)
Package

hunchentoot-errors.

Methods
Reader Method: log-sessionp ((errors-acceptor errors-acceptor))
Writer Method: (setf log-sessionp) ((errors-acceptor errors-acceptor))

When enabled, session information is written to the log.

Source

errors-acceptor.lisp.

Target Slot

log-session.

Generic Function: print-request (request format stream)

Prints REQUEST to STREAM in FORMAT

Package

hunchentoot-trace.

Source

trace-acceptor.lisp.

Methods
Method: print-request ((request request) (format (eql :text-log)) stream)
Method: print-request ((request request) format stream)
Generic Function: print-request (request format stream)

Prints REQUEST to STREAM in FORMAT

Package

hunchentoot-errors.

Source

errors-acceptor.lisp.

Methods
Method: print-request ((request request) (format (eql :html)) stream)
Method: print-request ((request request) (format (eql :text-log)) stream)
Method: print-request ((request request) format stream)
Generic Function: print-session (session format stream)

Prints SESSION to STREAM in FORMAT

Package

hunchentoot-trace.

Source

trace-acceptor.lisp.

Methods
Method: print-session ((session session) (format (eql :text-log)) stream)
Method: print-session ((session session) format stream)
Generic Function: print-session (session format stream)

Prints SESSION to STREAM in FORMAT

Package

hunchentoot-errors.

Source

errors-acceptor.lisp.

Methods
Method: print-session ((session session) (format (eql :html)) stream)
Method: print-session ((session session) (format (eql :text-log)) stream)
Method: print-session ((session session) format stream)

Appendix A Indexes


A.1 Concepts


A.2 Functions

Jump to:   (  
A   D   F   G   H   L   M   P  
Index Entry  Section

(
(setf debug-requestp): Private generic functions
(setf debug-requestp): Private generic functions
(setf debug-sessionp): Private generic functions
(setf debug-sessionp): Private generic functions
(setf log-requestp): Private generic functions
(setf log-requestp): Private generic functions
(setf log-sessionp): Private generic functions
(setf log-sessionp): Private generic functions

A
accept-format: Private ordinary functions
acceptor-log-access: Public standalone methods
acceptor-log-error: Private generic functions
acceptor-log-error: Private generic functions
acceptor-log-message: Public standalone methods
acceptor-status-message: Public standalone methods

D
debug-requestp: Private generic functions
debug-requestp: Private generic functions
debug-sessionp: Private generic functions
debug-sessionp: Private generic functions

F
Function, accept-format: Private ordinary functions
Function, http-error: Public ordinary functions

G
Generic Function, (setf debug-requestp): Private generic functions
Generic Function, (setf debug-sessionp): Private generic functions
Generic Function, (setf log-requestp): Private generic functions
Generic Function, (setf log-sessionp): Private generic functions
Generic Function, acceptor-log-error: Private generic functions
Generic Function, debug-requestp: Private generic functions
Generic Function, debug-sessionp: Private generic functions
Generic Function, log-requestp: Private generic functions
Generic Function, log-sessionp: Private generic functions
Generic Function, print-request: Private generic functions
Generic Function, print-request: Private generic functions
Generic Function, print-session: Private generic functions
Generic Function, print-session: Private generic functions

H
http-error: Public ordinary functions

L
log-requestp: Private generic functions
log-requestp: Private generic functions
log-sessionp: Private generic functions
log-sessionp: Private generic functions

M
Method, (setf debug-requestp): Private generic functions
Method, (setf debug-sessionp): Private generic functions
Method, (setf log-requestp): Private generic functions
Method, (setf log-sessionp): Private generic functions
Method, acceptor-log-access: Public standalone methods
Method, acceptor-log-error: Private generic functions
Method, acceptor-log-message: Public standalone methods
Method, acceptor-status-message: Public standalone methods
Method, debug-requestp: Private generic functions
Method, debug-sessionp: Private generic functions
Method, log-requestp: Private generic functions
Method, log-sessionp: Private generic functions
Method, print-request: Private generic functions
Method, print-request: Private generic functions
Method, print-request: Private generic functions
Method, print-request: Private generic functions
Method, print-request: Private generic functions
Method, print-session: Private generic functions
Method, print-session: Private generic functions
Method, print-session: Private generic functions
Method, print-session: Private generic functions
Method, print-session: Private generic functions

P
print-request: Private generic functions
print-request: Private generic functions
print-request: Private generic functions
print-request: Private generic functions
print-request: Private generic functions
print-request: Private generic functions
print-request: Private generic functions
print-session: Private generic functions
print-session: Private generic functions
print-session: Private generic functions
print-session: Private generic functions
print-session: Private generic functions
print-session: Private generic functions
print-session: Private generic functions