Closed nightshade427 closed 9 years ago
Any chance you're doing a return in one of your hooks? I'm not able to reproduce this. Can you give me a test case? Thanks!
Here is a test case, add the hook below and hit a route that exists (no error or isssue) then hit a route that doesnt exists (you get the error above):
(add-hook :pre-route
#'(lambda (hreq hres)
(with-promise (res rej)
(alet ((result (carrier:request "http://www.apple.com/" :return-body t)))
(res)))))
Sorry for the huge lag on this. Can you confirm this is still a problem? Having trouble reproducing. Here's my setup:
(ql:quickload '(:wookie :carrier))
(defpackage :errtest
(:use :cl :wookie :blackbird))
(in-package :errtest)
(add-hook :pre-route
#'(lambda (hreq hres)
(with-promise (res rej)
(alet ((result (carrier:request "http://www.apple.com/" :return-body t)))
(res))))
:err-test)
(defroute (:get "/") (req res)
(send-response res :body "hai"))
(defun start ()
(let ((wookie-config:*debug-on-error* t))
(as:with-event-loop ()
(start-server (make-instance 'listener :port 6969)))))
(start)
Testing with
$ curl 127.0.0.1:6969/
hai
$ curl 127.0.0.1:6969/test
Route for that resource not found =[.
Wookie log shows <WARN> [18:57:58] wookie - (route) Missing route: NIL
Here is what I used to test using latest ql from april and master git repo of: cl-async, blackbird, carrier, fast-http
(ql:quickload '("wookie" "carrier"))
(wookie:add-hook
:pre-route
#'(lambda (hreq hres)
(bb::with-promise (res rej)
(bb:catcher
(bb:alet ((result (carrier:request "http://www.apple.com/" :return-body t)))
(res result))
(t (e) (rej e))))))
(vom:config t :info)
(as:with-event-loop (:catch-app-errors t)
(wookie:start-server (make-instance 'wookie:listener :port 8888)))
Then did:
curl "http://nick.devs.firma8.com:8888/yell"; echo
Route for that resource not found =[.
Looked at repl:
<NOTICE> [16:34:36] wookie - (start) Starting Wookie 0.0.0.0:8888
<WARN> [16:34:51] wookie - (route) Missing route: NIL
<ERROR> [16:34:51] wookie - (hook) Error running hooks (socket #<TCP-SOCKET
{100CC7DAA3}>): attempt to RETURN-FROM a block or GO \
to a tag that no longer exists
If I do the same as above but leave the hook out, I get:
<NOTICE> [16:39:06] wookie - (start) Starting Wookie 0.0.0.0:8888
<WARN> [16:39:11] wookie - (route) Missing route: NIL
I found the cause of the issue (and will push a fix today), but it points out another problem. For some reason, when debugging is enabled for wookie/blackbird the error is just swallowed up and never reaches the REPL. However, if debugging is disabled in blackbird blackbird:*debug-on-error* => nil
the error is caught and printed out. Strange.
Awesome, thanks!! Let me know and I can test it out :)
I believe this is fixed, see 7259c10.
Also, remember that :catch-app-errors t
will silently ignore errors unless you give it a lambda.
Error seems to be gone now. Thanks!
It now only says <WARN> [14:11:33] wookie - (route) Missing route: NIL
it should say <WARN> [14:11:33] wookie - (route) Missing route: "/test-missing-route"
This is fixed in cfe9c4b, can you confirm?
perfect! thanks!
I get this when hitting wookie with a route that doesnt exist.