Documentation

AuthException extends ApplicationException
in package

Used when user authentication fails. Implements a softer error message.

Tags
author

Alexey Bobkov, Samuel Georges

Table of Contents

$hint  : string
$className  : string
$errorMessage  : string
$errorType  : string
$fileContent  : array<string|int, mixed>
$highlight  : stdObject
$mask  : Exception
$softErrors  : bool
__construct()  : mixed
Softens a detailed authentication error with a more vague message when the application is not in debug mode. This is for security reasons.
applyMask()  : void
This method is used when applying the mask exception to the face exception.
getCallStack()  : array<string|int, mixed>
Returns the call stack as an array of values containing a stack information object.
getClassName()  : string
Returns the class name of the called Exception.
getErrorType()  : string
Returns the error type derived from the error code used.
getHighlight()  : array<string|int, mixed>
Generates information used for highlighting the area of code in context of the exception line number.
getHighlightLines()  : array<string|int, mixed>
Returns an array of line numbers used for highlighting the problem area of code.
getTrueException()  : Exception
If this exception is acting as a mask, return the face exception. Otherwise return this exception as the true one.
mask()  : void
Masks an exception with the called class. This should catch fatal and php errors.
setMask()  : void
If this exception acts as a mask, sets the face for the foreign exception.
unmask()  : void
Removes the active mask from the called class.
filterCallStack()  : array<string|int, mixed>
Removes the final steps of a call stack, which add no value for the user.
formatStackArguments()  : string
Prepares a function or method argument list for display in HTML or text format

Properties

$hint

public string $hint

Hint Message to help the user with troubleshooting the error (optional).

$className

protected string $className

Class name of the called Exception.

$errorMessage

protected string $errorMessage

Default soft error message.

$errorType

protected string $errorType

Error type derived from the error code. Will be 'Undefined' if no code is used.

$fileContent

protected array<string|int, mixed> $fileContent = []

File content relating to the exception, each value of the array is a file line number.

$highlight

protected stdObject $highlight

Cached code information for highlighting code.

$mask

protected Exception $mask

If this exception is acting as a mask, this property stores the face exception.

$softErrors

protected bool $softErrors = false

Use less specific error messages.

Methods

__construct()

Softens a detailed authentication error with a more vague message when the application is not in debug mode. This is for security reasons.

public __construct([string $message = "" ], int $code[, Exception $previous = null ]) : mixed
Parameters
$message : string = ""

Error message.

$code : int

Error code.

$previous : Exception = null

Previous exception.

Return values
mixed

applyMask()

This method is used when applying the mask exception to the face exception.

public applyMask(Exception $exception) : void

It can be used as an override for child classes who may use different masking logic.

Parameters
$exception : Exception

Face exception being masked.

Return values
void

getCallStack()

Returns the call stack as an array of values containing a stack information object.

public getCallStack() : array<string|int, mixed>
Return values
array<string|int, mixed>

with stack information, each value will be an object with these values: id - The stack ID number. code - The class and function name being called. args - The arguments passed to the code function above. file - Reference to the file containing the called code. line - Reference to the line number of the file.

getClassName()

Returns the class name of the called Exception.

public getClassName() : string
Return values
string

getErrorType()

Returns the error type derived from the error code used.

public getErrorType() : string
Return values
string

getHighlight()

Generates information used for highlighting the area of code in context of the exception line number.

public getHighlight() : array<string|int, mixed>

The highlighted block of code will be six (6) lines before and after the problem line number.

Return values
array<string|int, mixed>

Highlight information as an array, the following keys are supplied: startLine - The starting line number, 6 lines before the error line. endLine - The ending line number, 6 lines after the error line. errorLine - The focused error line number. lines - An array of all the lines to be highlighted, each value is a line of code.

getHighlightLines()

Returns an array of line numbers used for highlighting the problem area of code.

public getHighlightLines() : array<string|int, mixed>

This will be six (6) lines before and after the error line number.

Return values
array<string|int, mixed>

Array of code lines.

getTrueException()

If this exception is acting as a mask, return the face exception. Otherwise return this exception as the true one.

public getTrueException() : Exception
Return values
Exception

The underlying exception, or this exception if no mask is applied.

mask()

Masks an exception with the called class. This should catch fatal and php errors.

public static mask([string $message = null ], int $code) : void

It should always be followed by the unmask() method to remove the mask.

Parameters
$message : string = null

Error message.

$code : int

Error code.

Return values
void

setMask()

If this exception acts as a mask, sets the face for the foreign exception.

public setMask(Exception $exception) : void
Parameters
$exception : Exception

Face for the mask, the underlying exception.

Return values
void

unmask()

Removes the active mask from the called class.

public static unmask() : void
Return values
void

filterCallStack()

Removes the final steps of a call stack, which add no value for the user.

protected filterCallStack(array<string|int, mixed> $traceInfo) : array<string|int, mixed>

The following exceptions and any trace information afterwards will be filtered:

  • Illuminate\Foundation\Bootstrap\HandleExceptions
Parameters
$traceInfo : array<string|int, mixed>

The trace information from getTrace() or debug_backtrace().

Return values
array<string|int, mixed>

The filtered array containing the trace information.

formatStackArguments()

Prepares a function or method argument list for display in HTML or text format

protected formatStackArguments(array<string|int, mixed> $arguments) : string
Parameters
$arguments : array<string|int, mixed>

A list of the function or method arguments

Return values
string

Search results