Improve error handling.

* Create an appHandler type that implements the http.Handler interface
  and handles errors.
* Create an appError type that wraps errors used by appHandler.