 
   onError: (error, res) ->
     res.status 500
+    res.end()
+
+  onUnhandled: (res) ->
+    res.status 404
     res.end()
 
 class App

  setProto res, Response

  # The unhandled request handler.
  req.next = default404.bind req, res

  # Prevent long-running requests.
  if app._timeout > 0

  res.send {error: "Request timed out"}
  @emit "response", req, res
  return
