-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rframe_Exception.php
58 lines (50 loc) · 1.54 KB
/
Rframe_Exception.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php
/*******************************************************************************
*
* Copyright (c) 2011, Ryan Cavis
* All rights reserved.
*
* This file is part of the rframe project <http://code.google.com/p/rframe/>
*
* Rframe is free software: redistribution and use with or without
* modification are permitted under the terms of the New/Modified
* (3-clause) BSD License.
*
* Rframe is provided as-is, without ANY express or implied warranties.
* Implied warranties of merchantability or fitness are disclaimed. See
* the New BSD License for details. A copy should have been provided with
* rframe, and is also at <http://www.opensource.org/licenses/BSD-3-Clause/>
*
******************************************************************************/
require_once "Rframe.php";
/**
* Exception specific to an error in the Rframe.
*
* @version 0.1
* @author ryancavis
* @package default
*/
class Rframe_Exception extends Exception {
/**
* Create an exception, using a static code value found in the Rframe
* class.
*
* @param int $code
* @param string $message (optional)
*/
public function __construct($code, $message=null) {
if (!$message) {
$message = Rframe::get_message($code);
}
parent::__construct($message, $code);
}
/**
* True if this exception is still a success for the Rframe.
*
* @return boolean
*/
public function is_success() {
$code = $this->getCode();
return $code >= Rframe::OKAY;
}
}