October\Rain\Exception\ExceptionBase

Overview

ExceptionBase class represents a base interface and set of properties for system and application exceptions.

Extends
  • Exception
Implements
  • Stringable
  • Throwable

Public Properties

public string $hint

hint message to help the user with troubleshooting the error (optional).

Protected Properties

protected Exception $mask

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

protected array $fileContent

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

protected string $className

className of the called Exception.

protected string $errorType

errorType derived from the error code, will be 'Undefined' if no code is used.

protected stdObject $highlight

highlight cached code information for highlighting code.

Show inherited protected properties

Inherited Protected Properties

  • $message - (defined in Exception)
  • $code - (defined in Exception)
  • $file - (defined in Exception)
  • $line - (defined in Exception)

Public Methods

public __construct()

public __construct(
    string $message = '',
    int $code = 0,
    Throwable $previous = null
): void

__construct the CMS base exception class, which inherits the native PHP Exception. All CMS related classes should inherit this class, it creates a set of unified properties and an interface for displaying the CMS exception page.

public applyMask()

public applyMask(Throwable $exception): void 

applyMask is used if this method is used when applying the mask exception to the face exception. It can be used as an override for child classes who may use different masking logic.

public getCallStack()

public getCallStack(): Array 

getCallStack returns the call stack as an array containing a stack information object.

public getClassName()

public getClassName(): string 

getClassName returns the class name of the called Exception.

public getErrorType()

public getErrorType(): string 

getErrorType returns the error type derived from the error code used.

public getHighlight()

public getHighlight(): object 

getHighlight generates information used for highlighting the area of code in context of the exception line number. The highlighted block of code will be six (6) lines before and after the problem line number.

public getHighlightLines()

public getHighlightLines(): array 

getHighlightLines returns an array of line numbers used for highlighting the problem area of code. This will be six (6) lines before and after the error line number.

public getNiceFile()

public getNiceFile(): string 

getNiceFile returns a file that is suitable for sharing.

public getTrueException()

public getTrueException(): Throwable 

getTrueException is used if this exception is acting as a mask, return the face exception. Otherwise return this exception as the true one.

public static mask()

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

mask an exception with the called class. This should catch fatal and php errors. It should always be followed by the unmask() method to remove the mask.

public setMask()

public setMask(Throwable $exception): void 

setMask is used if this exception acts as a mask, sets the face for the foreign exception.

public static unmask()

public static unmask(): void

unmask removes the active mask from the called class.

Show inherited public methods

Inherited Public Methods

  • __toString() - (defined in Exception)
  • __wakeup() - (defined in Exception)
  • getCode() - (defined in Exception)
  • getFile() - (defined in Exception)
  • getLine() - (defined in Exception)
  • getMessage() - (defined in Exception)
  • getPrevious() - (defined in Exception)
  • getTrace() - (defined in Exception)
  • getTraceAsString() - (defined in Exception)

Protected Methods

protected filterCallStack()

protected filterCallStack(array $traceInfo): array 

filterCallStack removes the final steps of a call stack, which add no value for the user. The following exceptions and any trace information afterwards will be filtered:

  • Illuminate\Foundation\Bootstrap\HandleExceptions

protected formatStackArguments()

protected formatStackArguments(array $arguments): string 

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