func errHandler(w http.ResponseWriter, r *http.Request, e error) {
	err := server.ToStatusError(e)
	log.Error(log.V{"error": err})
	view := view.NewWithPath("", w)
	view.AddKey("title", err.Title)
	view.AddKey("message", err.Message)
	if !config.Production() {
		view.AddKey("status", err.Status)
		view.AddKey("file", err.FileLine())
		view.AddKey("error", err.Err)
	}
	view.Template("app/views/error.html.got")
	w.WriteHeader(err.Status)
	view.Render()
}
errHandler renders an error using error templates if available
package app
import (
	"net/http"
	"os"
	"path"
	"strings"
	"github.com/fragmenta/server"
	"github.com/fragmenta/server/config"
	"github.com/fragmenta/server/log"
	"github.com/fragmenta/view"
)
func fileHandler(w http.ResponseWriter, r *http.Request) error {
	err := serveAsset(w, r)
	if err == nil {
		return nil
	}
	return serveFile(w, r)
}
func serveFile(w http.ResponseWriter, r *http.Request) error {
	localPath := "./public" + path.Clean(r.URL.Path)
	s, err := os.Stat(localPath)
	if err != nil {
		if os.IsNotExist(err) {
			return server.NotFoundError(err)
		}
		return server.NotAuthorizedError(err)
	}
	if s.IsDir() {
		return nil
	}
	w.Header().Set("Cache-Control", "max-age:3456000, public")
	http.ServeFile(w, r, localPath)
	return nil
}
func serveAsset(w http.ResponseWriter, r *http.Request) error {
	p := path.Clean(r.URL.Path)
	if !strings.HasPrefix(p, "/assets/") {
		return server.NotFoundError(nil)
	}
	f := appAssets.File(path.Base(p))
	if f == nil {
		return server.NotFoundError(nil)
	}
	localPath := "./" + f.LocalPath()
	w.Header().Set("Cache-Control", "max-age:3456000, public")
	http.ServeFile(w, r, localPath)
	return nil
}