ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.arException.php
Go to the documentation of this file.
1 <?php
2 
3 /******************************************************************************
4  *
5  * This file is part of ILIAS, a powerful learning management system.
6  *
7  * ILIAS is licensed with the GPL-3.0, you should have received a copy
8  * of said license along with the source code.
9  *
10  * If this is not the case or you just want to try ILIAS, you'll find
11  * us at:
12  * https://www.ilias.de
13  * https://github.com/ILIAS-eLearning
14  *
15  *****************************************************************************/
22 class arException extends ilException
23 {
24  public const UNKNONWN_EXCEPTION = -1;
25  public const COLUMN_DOES_NOT_EXIST = 1001;
26  public const COLUMN_DOES_ALREADY_EXIST = 1002;
27  public const RECORD_NOT_FOUND = 1003;
28  public const GET_UNCACHED_OBJECT = 1004;
29  public const LIST_WRONG_LIMIT = 1005;
30  public const LIST_ORDER_BY_WRONG_FIELD = 1006;
31  public const LIST_JOIN_ON_WRONG_FIELD = 1007;
32  public const COPY_DESTINATION_ID_EXISTS = 1008;
33  public const PRIVATE_CONTRUCTOR = 1009;
34  public const FIELD_UNKNOWN = 1010;
35  protected static array $message_strings = array(
36  self::UNKNONWN_EXCEPTION => 'Unknown Exception',
37  self::COLUMN_DOES_NOT_EXIST => 'Column does not exist:',
38  self::COLUMN_DOES_ALREADY_EXIST => 'Column does already exist:',
39  self::RECORD_NOT_FOUND => 'No Record found with PrimaryKey:',
40  self::GET_UNCACHED_OBJECT => 'Get uncached Object from Cache:',
41  self::LIST_WRONG_LIMIT => 'Limit, to value smaller than from value:',
42  self::LIST_JOIN_ON_WRONG_FIELD => 'Join on non existing field: ',
43  self::COPY_DESTINATION_ID_EXISTS => 'Copy Record: A record with the Destination-ID already exists.',
44  self::PRIVATE_CONTRUCTOR => 'Constructor cannot be accessed.',
45  self::FIELD_UNKNOWN => 'Field Unknown.',
46  );
50  protected $message = '';
54  protected $code = self::UNKNONWN_EXCEPTION;
55  protected string $additional_info = '';
56 
61  public function __construct($exception_code = self::UNKNONWN_EXCEPTION, $additional_info = '')
62  {
63  $this->code = $exception_code;
64  $this->additional_info = $additional_info;
65  $this->assignMessageToCode();
66  parent::__construct($this->message, $this->code);
67  }
68 
69  protected function assignMessageToCode(): void
70  {
71  $this->message = 'ActiveRecord Exeption: ' . self::$message_strings[$this->code] . $this->additional_info;
72  }
73 
77  public function __toString()
78  {
79  return implode('<br>', array(get_class($this), $this->message));
80  }
81 }
const UNKNONWN_EXCEPTION
__construct($exception_code=self::UNKNONWN_EXCEPTION, $additional_info='')
const LIST_ORDER_BY_WRONG_FIELD
const GET_UNCACHED_OBJECT
const COPY_DESTINATION_ID_EXISTS
const COLUMN_DOES_ALREADY_EXIST
const PRIVATE_CONTRUCTOR
Class arException.
string $additional_info
__construct(Container $dic, ilPlugin $plugin)
static array $message_strings
const COLUMN_DOES_NOT_EXIST
const LIST_JOIN_ON_WRONG_FIELD