Exception oriented programming

Report a typo

Consider that you have the following custom exception class:

class InvalidCredentialsException : Exception()

And a Status Pages configuration with the following code:

exception<InvalidCredentialsException> { call, cause ->
    call.respondText(
        text = "401: Invalid credentials", status = HttpStatusCode.Unauthorized
    )
}

How do you raise an exception that will be caught by this handler?

Select one option from the list
___

Create a free account to access the full topic