ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilCloudException.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once './Services/Exceptions/classes/class.ilException.php';
5 
15 {
16  const UNKNONW_EXCEPTION = -1;
17 
18  const NO_SERVICE_ACTIVE = 1001;
19  const NO_SERVICE_SELECTED = 1002;
20  const SERVICE_NOT_ACTIVE = 1003;
23 
27 
28  const AUTHENTICATION_FAILED = 2001;
29  const DELETE_FAILED = 2101;
30  const DOWNLOAD_FAILED = 2201;
31  const FOLDER_CREATION_FAILED = 2301;
32  const UPLOAD_FAILED = 2401;
35 
36  const INVALID_INPUT = 3001;
37 
41 
42  const PERMISSION_DENIED = 5001;
44 
45  protected $message;
46  protected $code;
47  protected $add_info;
48 
53  public function __construct($exception_code, $exception_info = "")
54  {
55 
56 
57  $this->code = $exception_code;
58  $this->add_info = $exception_info;
59  $this->assignMessageToCode();
60  parent::__construct($this->message, $this->code);
61 
62  }
63 
64  protected function assignMessageToCode()
65  {
66  global $lng;
67  switch ($this->code)
68  {
69  case self::NO_SERVICE_ACTIVE:
70  $this->message = $lng->txt("cld_no_service_active") . " " . $this->add_info;
71  break;
72  case self::NO_SERVICE_SELECTED:
73  $this->message = $lng->txt("cld_no_service_selected") . " " . $this->add_info;
74  break;
75  case self::SERVICE_NOT_ACTIVE:
76  $this->message = $lng->txt("cld_service_not_active") . " " . $this->add_info;
77  break;
78  case self::SERVICE_CLASS_FILE_NOT_FOUND:
79  $this->message = $lng->txt("cld_service_class_file_not_found") . " " . $this->add_info;
80  break;
81  case self::FOLDER_NOT_EXISTING_ON_SERVICE:
82  $this->message = $lng->txt("cld_folder_not_existing_on_service") . " " . $this->add_info;
83  break;
84  case self::FOLDER_ALREADY_EXISTING_ON_SERVICE:
85  $this->message = $lng->txt("cld_folder_already_existing_on_service") . " " . $this->add_info;
86  break;
87  case self::FILE_NOT_EXISTING_ON_SERVICE:
88  $this->message = $lng->txt("cld_file_not_existing_on_service") . " " . $this->add_info;
89  break;
90  case self::AUTHENTICATION_FAILED:
91  $this->message = $lng->txt("cld_authentication_failed") . " " . $this->add_info;
92  break;
93  case self::DELETE_FAILED:
94  $this->message = $lng->txt("cld_delete_failed") . " " . $this->add_info;
95  break;
96  case self::ADD_ITEMS_FROM_SERVICE_FAILED:
97  $this->message = $lng->txt("cld_add_items_from_service_failed") . " " . $this->add_info;
98  break;
99  case self::DOWNLOAD_FAILED:
100  $this->message = $lng->txt("cld_add_download_failed") . " " . $this->add_info;
101  break;
102  case self::FOLDER_CREATION_FAILED:
103  $this->message = $lng->txt("cld_folder_creation_failed") . " " . $this->add_info;
104  break;
105  case self::UPLOAD_FAILED:
106  $this->message = $lng->txt("cld_upload_failed") . " " . $this->add_info;
107  break;
108  case self::UPLOAD_FAILED_MAX_FILESIZE:
109  $this->message = $lng->txt("cld_upload_failed_max_filesize") . " " . $this->add_info;
110  break;
111  case self::INVALID_INPUT:
112  $this->message = $lng->txt("cld_invalid_input") . " " . $this->add_info;
113  break;
114  case self::PATH_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION:
115  $this->message = $lng->txt("cld_path_does_not_exist_in_file_tree_in_session") . " " . $this->add_info;
116  break;
117  case self::ID_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION:
118  $this->message = $lng->txt("cld_id_does_not_exist_in_file_tree_in_session") . " " . $this->add_info;
119  break;
120  case self::ID_ALREADY_EXISTS_IN_FILE_TREE_IN_SESSION:
121  $this->message = $lng->txt("cld_id_already_exists_in_file_tree_in_session") . " " . $this->add_info;
122  break;
123  case self::PLUGIN_HOOK_COULD_NOT_BE_INSTANTIATED:
124  $this->message = $lng->txt("cld_plugin_hook_could_not_be_instantiated") . " " . $this->add_info;
125  break;
126  case self::PERMISSION_DENIED:
127  $this->message = $lng->txt("cld_permission_denied") . " " . $this->add_info;
128  break;
129  case self::PERMISSION_TO_CHANGE_ROOT_FOLDER_DENIED:
130  $this->message = $lng->txt("cld_permission_to_change_root_folder_denied") . " " . $this->add_info;
131  break;
132  default:
133  $this->message = $lng->txt("cld_unknown_exception") . " " . $this->add_info;
134  break;
135  }
136  }
137 
138  public function __toString()
139  {
140  return get_class($this) . " '{$this->message}' in {$this->file}({$this->line})\n"
141  . "{$this->getTraceAsString()}";
142  }
143 
144 }
145 ?>