Class RException extends ErrorException
This class is a minor extension of the regular Exception class. Rather than using numbers, RawDev exceptions use string based types (e.g. not_null, division_by_zero).
Example
<?php
require_once('RawDev/RawDev.php');
try {
throw new RException('email_illegal_format', 'Email [%s] has an illegal format', 'test@test');
}
catch (RException $e) {
if ($e->type == 'email_illegal_format') print $e->message."n";
}
?>
Vars
var string $type
Type of error (e.g. division_by_zero).
var string $message
The final error string such as in (e.g. "Var [id] cannot be null.").
var string $template
The template error string such as in sprintf (e.g. "Var [%s] cannot be null.").
var string[] $params
An array of string params that are displayed in the message.
Functions
RException function __construct($type, $template, $param[, $...])
Throws a Rawdev exception.
$type | string | Type of error (e.g. division_by_zero). |
$template | string | Error message suitable for sprintf (e.g. "Var [%s] cannot be null"). |
$param | string | Zero or more parameters passed into the message. |
returns | RException | Returns exception. |
Example
<?php
throw new RException('email_illegal_format', 'Email has an illegal format');
?>
|