View Source CsrfPlus.Exception exception (CsrfPlus v0.1.2)

CsrfPlus exceptions.

Summary

Functions

Checks if the given exception is a CsrfPlus exception. Returns a boolean true if the given exception is a CsrfPlus.

Creates a new CsrfPlus exception based on the given params during the Kernel.raise/2 call.

Retrieve all the CsrfPlus exceptions with their corresponding names and messages

Functions

Link to this function

csrf_plus_exception?(exception)

View Source

Checks if the given exception is a CsrfPlus exception. Returns a boolean true if the given exception is a CsrfPlus.

Creates a new CsrfPlus exception based on the given params during the Kernel.raise/2 call.

Passing no param will create a CsrfPlus.Exception.

If a string is passed it will be used as the exception message.

If it's an exception module name (an atom) an exception will be created from it with the default message set in the exceptions/0 function.

When a tuple is passed in the format {which, type} an exception with name which will be created having the message set in the exception/1 function with the message in type.

Examples

 iex> raise CsrfPlus.Exception
 ** (CsrfPlus.Exception) invalid token

 iex> raise CsrfPlus.Exception, "custom message"
 ** (CsrfPlus.Exception) custom message

 iex> raise CsrfPlus.Exception, CsrfPlus.Exception.StoreException
 ** (CsrfPlus.Exception.StoreException) no store is set

 iex> raise CsrfPlus.Exception, {CsrfPlus.Exception.StoreException, :token_not_found}
 ** (CsrfPlus.Exception.StoreException) token was not found

Retrieve all the CsrfPlus exceptions with their corresponding names and messages