ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.arException.php
Go to the documentation of this file.
1 <?php
2 
11 class arException extends Exception {
12 
13  const UNKNONWN_EXCEPTION = - 1;
14  const COLUMN_DOES_NOT_EXIST = 1001;
16  const RECORD_NOT_FOUND = 1003;
17  const GET_UNCACHED_OBJECT = 1004;
18  const LIST_WRONG_LIMIT = 1005;
22  const PRIVATE_CONTRUCTOR = 1009;
23  const FIELD_UNKNOWN = 1010;
27  protected static $message_strings = array(
28  self::UNKNONWN_EXCEPTION => 'Unknown Exception',
29  self::COLUMN_DOES_NOT_EXIST => 'Column does not exist:',
30  self::COLUMN_DOES_ALREADY_EXIST => 'Column does already exist:',
31  self::RECORD_NOT_FOUND => 'No Record found with PrimaryKey:',
32  self::GET_UNCACHED_OBJECT => 'Get uncached Object from Cache:',
33  self::LIST_WRONG_LIMIT => 'Limit, to value smaller than from value:',
34  self::LIST_JOIN_ON_WRONG_FIELD => 'Join on non existing field: ',
35  self::COPY_DESTINATION_ID_EXISTS => 'Copy Record: A record with the Destination-ID already exists.',
36  self::PRIVATE_CONTRUCTOR => 'Constructor cannot be accessed.',
37  self::FIELD_UNKNOWN => 'Field Unknown.',
38  );
42  protected $message = '';
50  protected $additional_info = '';
51 
52 
57  public function __construct($exception_code = self::UNKNONWN_EXCEPTION, $additional_info = '') {
58  $this->code = $exception_code;
59  $this->additional_info = $additional_info;
60  $this->assignMessageToCode();
61  parent::__construct($this->message, $this->code);
62  }
63 
64 
65  protected function assignMessageToCode() {
66  $this->message = 'ActiveRecord Exeption: ' . self::$message_strings[$this->code] . $this->additional_info;
67  }
68 
69 
73  public function __toString() {
74  return implode('<br>', array( get_class($this), $this->message ));
75  }
76 }
77 
78 ?>