Genie.Exceptions.ExceptionalResponseType
struct ExceptionalResponse <: Exception

A type of exception which wraps an HTTP Response object. The thrown exception will propagate until it is caught up the app stack or ultimately by Genie and the wrapped response is sent to the client.

Example

If the user is not authenticated, an ExceptionalResponse is thrown - if the exception is not caught in the app's stack, Genie will catch it and return the wrapped Response object, forcing an HTTP redirect to the login page.

isauthenticated() || throw(ExceptionalResponse(redirect(:show_login)))
source
Genie.Exceptions.InternalServerExceptionType
struct InternalServerException <: Exception

Dedicated exception type for server side exceptions. Results in a 500 error by default.

Arguments

  • message::String
  • info::String
  • code::Int
source
Genie.Exceptions.NotFoundExceptionType
struct NotFoundException <: Exception

Specialized exception representing a not found resources. Results in a 404 response being sent to the client.

Arguments

  • message::String
  • info::String
  • code::Int
  • resource::String
source
Genie.Exceptions.RuntimeExceptionType
RuntimeException

Represents an unexpected and unhandled runtime exceptions. An error event will be logged and the exception will be sent to the client, depending on the environment (the error stack is dumped by default in dev mode or an error message is displayed in production).

It allows defining custom error message and info, as well as an error code, in addition to the exception object.

Arguments

  • message::String
  • info::String
  • code::Int
  • ex::Union{Nothing,Exception}
source