Commit 80c5981c authored by LONGMAN's avatar LONGMAN

Fixed exception bug

parent e68b85a1
......@@ -122,7 +122,7 @@ class DateCommand extends Command
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_code !== 200) {
throw new Exception('Error receiving data from url');
throw new \Exception('Error receiving data from url');
}
curl_close($ch);
......
......@@ -36,7 +36,7 @@ class WeatherCommand extends Command
$http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
if ($http_code !== 200) {
throw new Exception('Error receiving data from url');
throw new \Exception('Error receiving data from url');
}
curl_close($ch);
......
......@@ -23,7 +23,7 @@ class Chat
$this->id = isset($data['id']) ? $data['id'] : null;
if (empty($this->id)) {
throw new Exception('id is empty!');
throw new \Exception('id is empty!');
}
}
......
......@@ -64,19 +64,19 @@ class Message
$this->message_id = isset($data['message_id']) ? $data['message_id'] : null;
if (empty($this->message_id)) {
throw new Exception('message_id is empty!');
throw new \Exception('message_id is empty!');
}
$this->from = isset($data['from']) ? $data['from'] : null;
if (empty($this->from)) {
throw new Exception('from is empty!');
throw new \Exception('from is empty!');
}
$this->from = new User($this->from);
$this->date = isset($data['date']) ? $data['date'] : null;
if (empty($this->date)) {
throw new Exception('date is empty!');
throw new \Exception('date is empty!');
}
$this->chat = isset($data['chat']) ? $data['chat'] : null;
......
......@@ -28,7 +28,7 @@ class Update
$message = isset($data['message']) ? $data['message'] : null;
if (empty($update_id)) {
throw new Exception('update_id is empty!');
throw new \Exception('update_id is empty!');
}
$this->update_id = $update_id;
......
......@@ -25,12 +25,12 @@ class User
$this->id = isset($data['id']) ? $data['id'] : null;
if (empty($this->id)) {
throw new Exception('id is empty!');
throw new \Exception('id is empty!');
}
$this->first_name = isset($data['first_name']) ? $data['first_name'] : null;
if (empty($this->first_name)) {
throw new Exception('first_name is empty!');
throw new \Exception('first_name is empty!');
}
$this->last_name = isset($data['last_name']) ? $data['last_name'] : null;
......
......@@ -98,7 +98,7 @@ class Request
public static function sendMessage(array $data) {
if (empty($data)) {
throw new Exception('Data is empty!');
throw new \Exception('Data is empty!');
}
$result = self::send('sendMessage', $data);
......
......@@ -163,14 +163,14 @@ class Telegram
if (empty($this->input)) {
throw new Exception('Input is empty!');
throw new \Exception('Input is empty!');
}
$post = json_decode($this->input, true);
if (empty($post)) {
throw new Exception('Invalid JSON!');
throw new \Exception('Invalid JSON!');
}
......@@ -230,7 +230,7 @@ class Telegram
*/
public function addCommandsPath($folder) {
if (!is_dir($folder)) {
throw new Exception('Commands folder not exists!');
throw new \Exception('Commands folder not exists!');
}
$this->commands_dir[] = $folder;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment