```install(StatusPages) { exception<Authenti...
# ktor
o
Copy code
install(StatusPages) {
   exception<AuthenticationException> { call, cause ->
      call.respond(
         HttpStatusCode.Unauthorized,
         message = cause.message ?: "Unauthorized message"
      )
   }
   exception<AuthorizationException> { call, cause ->
      call.respond(HttpStatusCode.Forbidden, message = cause.message ?: "Unauthorized message")
   }
   status(HttpStatusCode.NotFound) { call, _ ->
      call.respond(
         mapOf("message" to "404: Page Not Found")
      )
   }
   exception<Throwable> { call, cause ->
      call.respondText(text = "500: $cause", status = HttpStatusCode.InternalServerError)
   }
}