Skip to content

Commit 80c5981

Browse files
committed
Fixed exception bug
1 parent e68b85a commit 80c5981

File tree

8 files changed

+13
-13
lines changed

8 files changed

+13
-13
lines changed

src/Commands/DateCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ private function request($url) {
122122

123123
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
124124
if ($http_code !== 200) {
125-
throw new Exception('Error receiving data from url');
125+
throw new \Exception('Error receiving data from url');
126126
}
127127
curl_close($ch);
128128

src/Commands/WeatherCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ private function getWeather($location) {
3636

3737
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
3838
if ($http_code !== 200) {
39-
throw new Exception('Error receiving data from url');
39+
throw new \Exception('Error receiving data from url');
4040
}
4141
curl_close($ch);
4242

src/Entities/Chat.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function __construct(array $data) {
2323

2424
$this->id = isset($data['id']) ? $data['id'] : null;
2525
if (empty($this->id)) {
26-
throw new Exception('id is empty!');
26+
throw new \Exception('id is empty!');
2727
}
2828

2929
}

src/Entities/Message.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,19 @@ public function __construct(array $data) {
6464

6565
$this->message_id = isset($data['message_id']) ? $data['message_id'] : null;
6666
if (empty($this->message_id)) {
67-
throw new Exception('message_id is empty!');
67+
throw new \Exception('message_id is empty!');
6868
}
6969

7070
$this->from = isset($data['from']) ? $data['from'] : null;
7171
if (empty($this->from)) {
72-
throw new Exception('from is empty!');
72+
throw new \Exception('from is empty!');
7373
}
7474
$this->from = new User($this->from);
7575

7676

7777
$this->date = isset($data['date']) ? $data['date'] : null;
7878
if (empty($this->date)) {
79-
throw new Exception('date is empty!');
79+
throw new \Exception('date is empty!');
8080
}
8181

8282
$this->chat = isset($data['chat']) ? $data['chat'] : null;

src/Entities/Update.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(array $data) {
2828
$message = isset($data['message']) ? $data['message'] : null;
2929

3030
if (empty($update_id)) {
31-
throw new Exception('update_id is empty!');
31+
throw new \Exception('update_id is empty!');
3232
}
3333

3434
$this->update_id = $update_id;

src/Entities/User.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ public function __construct(array $data) {
2525

2626
$this->id = isset($data['id']) ? $data['id'] : null;
2727
if (empty($this->id)) {
28-
throw new Exception('id is empty!');
28+
throw new \Exception('id is empty!');
2929
}
3030

3131
$this->first_name = isset($data['first_name']) ? $data['first_name'] : null;
3232
if (empty($this->first_name)) {
33-
throw new Exception('first_name is empty!');
33+
throw new \Exception('first_name is empty!');
3434
}
3535

3636
$this->last_name = isset($data['last_name']) ? $data['last_name'] : null;

src/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public static function send($action, array $data = null) {
9898
public static function sendMessage(array $data) {
9999

100100
if (empty($data)) {
101-
throw new Exception('Data is empty!');
101+
throw new \Exception('Data is empty!');
102102
}
103103

104104
$result = self::send('sendMessage', $data);

src/Telegram.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,14 @@ public function handle() {
163163

164164

165165
if (empty($this->input)) {
166-
throw new Exception('Input is empty!');
166+
throw new \Exception('Input is empty!');
167167
}
168168

169169

170170

171171
$post = json_decode($this->input, true);
172172
if (empty($post)) {
173-
throw new Exception('Invalid JSON!');
173+
throw new \Exception('Invalid JSON!');
174174
}
175175

176176

@@ -230,7 +230,7 @@ protected function getCommandClass($command, Update $update) {
230230
*/
231231
public function addCommandsPath($folder) {
232232
if (!is_dir($folder)) {
233-
throw new Exception('Commands folder not exists!');
233+
throw new \Exception('Commands folder not exists!');
234234
}
235235
$this->commands_dir[] = $folder;
236236
}

0 commit comments

Comments
 (0)