Documentation

Breaker extends Exception
in package

Application exception with some canned codes and multiple error message capability.

Table of Contents

BAD_ACCOUNT  = 2
BAD_REQUEST  = 1
BAD_REVISION  = 5
BATCH_FAILED  = 10
CONFIG_ERROR  = 8
INTEGRITY_ERROR  = 7
INVALID_DATA  = 6
NOT_IMPLEMENTED  = 4
RULE_VIOLATION  = 3
SYSTEM_ERROR  = 9
addError()  : void
Add a new message to the error list.
getErrors()  : array<string|int, mixed>
Get the error list, optionally with the exception message.
mergeErrors()  : void
Add several messages to the error list.
setErrors()  : void
Replace the error list with a new list.
withCode()  : static
Generate a new instance using a predefined code.

Constants

BAD_ACCOUNT

public mixed BAD_ACCOUNT = 2

BAD_REQUEST

public mixed BAD_REQUEST = 1

BAD_REVISION

public mixed BAD_REVISION = 5

BATCH_FAILED

public mixed BATCH_FAILED = 10

CONFIG_ERROR

public mixed CONFIG_ERROR = 8

INTEGRITY_ERROR

public mixed INTEGRITY_ERROR = 7

INVALID_DATA

public mixed INVALID_DATA = 6

NOT_IMPLEMENTED

public mixed NOT_IMPLEMENTED = 4

RULE_VIOLATION

public mixed RULE_VIOLATION = 3

SYSTEM_ERROR

public mixed SYSTEM_ERROR = 9

Methods

addError()

Add a new message to the error list.

public addError(string $error) : void
Parameters
$error : string
Return values
void

getErrors()

Get the error list, optionally with the exception message.

public getErrors([bool $withMessage = false ]) : array<string|int, mixed>
Parameters
$withMessage : bool = false

If true, the exception main message is added to the start of the list.

Return values
array<string|int, mixed>

mergeErrors()

Add several messages to the error list.

public mergeErrors([array<string|int, string> $errors = [] ]) : void
Parameters
$errors : array<string|int, string> = []
Return values
void

setErrors()

Replace the error list with a new list.

public setErrors(array<string|int, string>|string $errors) : void
Parameters
$errors : array<string|int, string>|string
Return values
void

withCode()

Generate a new instance using a predefined code.

public static withCode(int $code[, array<string|int, string>|string $errors = [] ][, Throwable|null $previous = null ]) : static
Parameters
$code : int

The underlying error condition

$errors : array<string|int, string>|string = []

One or a list of supplemental error texts.

$previous : Throwable|null = null

Any related exception

Return values
static

Search results