fukamachi / clack

Web server abstraction layer for Common Lisp
MIT License
1.04k stars 86 forks source link

Is there a recommended way to catch errors at startup? #180

Open iamFIREcracker opened 1 year ago

iamFIREcracker commented 1 year ago

I would like to catch USOCKET:ADDRESS-IN-USE-ERROR so I can prompt the user to provide a different port, but it looks like the error is getting thrown in a background thread.

Hunchentoot server is started.
Listening on 127.0.0.1:4242.

debugger invoked on a USOCKET:ADDRESS-IN-USE-ERROR in thread
#<THREAD "clack-handler-hunchentoot" RUNNING {7005713283}>:
  Condition USOCKET:ADDRESS-IN-USE-ERROR was signalled.

The current thread is not at the foreground,
SB-THREAD:RELEASE-FOREGROUND has to be called in #<SB-THREAD:THREAD "main thread" waiting on: #<WAITQUEUE clack-handler-hunchentoot {7005713203}> {700546AB13}>
for this thread to enter the debugger.

Happy to look into this, but if you got some hints, please share with me before I get down the rabbit hole!