ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclInputException.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4require_once './Services/Exceptions/classes/class.ilException.php';
5
18
19 const TYPE_EXCEPTION = 0;
21 const REGEX_EXCEPTION = 2;
23 const NOT_URL = 4;
24 const NOT_IMAGE = 5;
25 const WRONG_FILE_TYPE = 6;
26 const CUSTOM_MESSAGE = 7;
28
29
33 protected $exception_type;
34
39
40
45 parent::__construct($exception_type);
46 $this->exception_type = $exception_type;
47 $this->additional_text = $additional_text;
48 }
49
50
54 public function getExceptionType() {
56 }
57
58
62 public function __toString() {
63 global $DIC;
64 $lng = $DIC['lng'];
65
66 switch ($this->exception_type) {
68 $message = $lng->txt('dcl_wrong_input_type');
69 break;
71 $message = $lng->txt('dcl_wrong_length');
72 break;
74 $message = $lng->txt('dcl_wrong_regex');
75 break;
77 $message = $lng->txt('dcl_invalid_regex_config');
78 break;
80 $message = $lng->txt('dcl_unique_exception');
81 break;
82 case self::NOT_URL:
83 $message = $lng->txt('dcl_noturl_exception');
84 break;
85 case self::NOT_IMAGE:
86 $message = $lng->txt('dcl_notimage_exception');
87 break;
89 $message = $lng->txt('dcl_not_supported_file_type');
90 break;
93 break;
94 default:
95 $message = $lng->txt('dcl_unknown_exception');
96 }
97
98 if(strlen($this->additional_text) > 0) {
99 $message .= " ".$this->additional_text;
100 }
101
102 return $message;
103 }
104}
An exception for terminatinating execution or to throw for unit testing.
Class ilDclBaseFieldModel.
__construct($exception_type, $additional_text="")
Base class for ILIAS Exception handling.
global $lng
Definition: privfeed.php:17
global $DIC