format error messages and do 404s