Skip to content

Commit b8e3b4b

Browse files
committed
Fix exception handling for ConversationDB.
1 parent 7db0a91 commit b8e3b4b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/ConversationDB.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
namespace Longman\TelegramBot;
1212

1313
use Longman\TelegramBot\DB;
14+
use Longman\TelegramBot\Exception\TelegramException;
1415

1516
/**
1617
* Class ConversationDB
@@ -63,7 +64,7 @@ public static function selectConversation($user_id, $chat_id, $limit = null)
6364

6465
$results = $sth->fetchAll(\PDO::FETCH_ASSOC);
6566

66-
} catch (PDOException $e) {
67+
} catch (\Exception $e) {
6768
throw new TelegramException($e->getMessage());
6869
}
6970
return $results;
@@ -106,7 +107,7 @@ public static function insertConversation($user_id, $chat_id, $command)
106107
$sth->bindParam(':date', $created_at);
107108

108109
$status = $sth->execute();
109-
} catch (PDOException $e) {
110+
} catch (\Exception $e) {
110111
throw new TelegramException($e->getMessage());
111112
}
112113
return $status;
@@ -178,7 +179,7 @@ public static function update($table, array $fields_values, array $where_fields_
178179
try {
179180
$sth = self::$pdo->prepare($query);
180181
$status = $sth->execute($tokens);
181-
} catch (PDOException $e) {
182+
} catch (\Exception $e) {
182183
throw new TelegramException($e->getMessage());
183184
}
184185
return $status;

0 commit comments

Comments
 (0)