ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules 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  const NO_SERVICE_ACTIVE = 1001;
18  const NO_SERVICE_SELECTED = 1002;
19  const SERVICE_NOT_ACTIVE = 1003;
25  const AUTHENTICATION_FAILED = 2001;
26  const DELETE_FAILED = 2101;
27  const DOWNLOAD_FAILED = 2201;
28  const FOLDER_CREATION_FAILED = 2301;
29  const UPLOAD_FAILED = 2401;
32  const INVALID_INPUT = 3001;
36  const PERMISSION_DENIED = 5001;
38  protected $message;
39  protected $code;
40  protected $add_info;
41 
42 
47  public function __construct($exception_code, $exception_info = "")
48  {
49  $this->code = $exception_code;
50  $this->add_info = $exception_info;
51  $this->assignMessageToCode();
52  parent::__construct($this->message, $this->code);
53  }
54 
55 
56  protected function assignMessageToCode()
57  {
58  global $DIC;
59  $lng = $DIC['lng'];
60  switch ($this->code) {
61  case self::NO_SERVICE_ACTIVE:
62  $this->message = $lng->txt("cld_no_service_active");
63  break;
64  case self::NO_SERVICE_SELECTED:
65  $this->message = $lng->txt("cld_no_service_selected");
66  break;
67  case self::SERVICE_NOT_ACTIVE:
68  $this->message = $lng->txt("cld_service_not_active");
69  break;
70  case self::SERVICE_CLASS_FILE_NOT_FOUND:
71  $this->message = $lng->txt("cld_service_class_file_not_found");
72  break;
73  case self::FOLDER_NOT_EXISTING_ON_SERVICE:
74  $this->message = $lng->txt("cld_folder_not_existing_on_service");
75  break;
76  case self::FOLDER_ALREADY_EXISTING_ON_SERVICE:
77  $this->message = $lng->txt("cld_folder_already_existing_on_service");
78  break;
79  case self::FILE_NOT_EXISTING_ON_SERVICE:
80  $this->message = $lng->txt("cld_file_not_existing_on_service");
81  break;
82  case self::AUTHENTICATION_FAILED:
83  $this->message = $lng->txt("cld_authentication_failed");
84  break;
85  case self::DELETE_FAILED:
86  $this->message = $lng->txt("cld_delete_failed");
87  break;
88  case self::ADD_ITEMS_FROM_SERVICE_FAILED:
89  $this->message = $lng->txt("cld_add_items_from_service_failed");
90  break;
91  case self::DOWNLOAD_FAILED:
92  $this->message = $lng->txt("cld_add_download_failed");
93  break;
94  case self::FOLDER_CREATION_FAILED:
95  $this->message = $lng->txt("cld_folder_creation_failed");
96  break;
97  case self::UPLOAD_FAILED:
98  $this->message = $lng->txt("cld_upload_failed");
99  break;
100  case self::UPLOAD_FAILED_MAX_FILESIZE:
101  $this->message = $lng->txt("cld_upload_failed_max_filesize");
102  break;
103  case self::INVALID_INPUT:
104  $this->message = $lng->txt("cld_invalid_input");
105  break;
106  case self::PATH_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION:
107  $this->message = $lng->txt("cld_path_does_not_exist_in_file_tree_in_session");
108  break;
109  case self::ID_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION:
110  $this->message = $lng->txt("cld_id_does_not_exist_in_file_tree_in_session");
111  break;
112  case self::ID_ALREADY_EXISTS_IN_FILE_TREE_IN_SESSION:
113  $this->message = $lng->txt("cld_id_already_exists_in_file_tree_in_session");
114  break;
115  case self::PLUGIN_HOOK_COULD_NOT_BE_INSTANTIATED:
116  $this->message = $lng->txt("cld_plugin_hook_could_not_be_instantiated");
117  break;
118  case self::PERMISSION_DENIED:
119  $this->message = $lng->txt("cld_permission_denied");
120  break;
121  case self::PERMISSION_TO_CHANGE_ROOT_FOLDER_DENIED:
122  $this->message = $lng->txt("cld_permission_to_change_root_folder_denied");
123  break;
124  default:
125  $this->message = $lng->txt("cld_unknown_exception");
126  break;
127  }
128  $this->message .= ($this->add_info ? ": " : "") . $this->add_info;
129  }
130 
131 
132  public function __toString()
133  {
134  return get_class($this) . " '{$this->message}' in {$this->file}({$this->line})\n"
135  . "{$this->getTraceAsString()}";
136  }
137 }
const PATH_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION
__construct($exception_code, $exception_info="")
const ID_DOES_NOT_EXIST_IN_FILE_TREE_IN_SESSION
const PERMISSION_TO_CHANGE_ROOT_FOLDER_DENIED
$lng
const ID_ALREADY_EXISTS_IN_FILE_TREE_IN_SESSION
__construct(Container $dic, ilPlugin $plugin)
$DIC
Definition: xapitoken.php:46
Class ilCloudException.