Commit b8e3b4b9 authored by Armando Lüscher's avatar Armando Lüscher

Fix exception handling for ConversationDB.

parent 7db0a913
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
namespace Longman\TelegramBot; namespace Longman\TelegramBot;
use Longman\TelegramBot\DB; use Longman\TelegramBot\DB;
use Longman\TelegramBot\Exception\TelegramException;
/** /**
* Class ConversationDB * Class ConversationDB
...@@ -63,7 +64,7 @@ class ConversationDB extends DB ...@@ -63,7 +64,7 @@ class ConversationDB extends DB
$results = $sth->fetchAll(\PDO::FETCH_ASSOC); $results = $sth->fetchAll(\PDO::FETCH_ASSOC);
} catch (PDOException $e) { } catch (\Exception $e) {
throw new TelegramException($e->getMessage()); throw new TelegramException($e->getMessage());
} }
return $results; return $results;
...@@ -106,7 +107,7 @@ class ConversationDB extends DB ...@@ -106,7 +107,7 @@ class ConversationDB extends DB
$sth->bindParam(':date', $created_at); $sth->bindParam(':date', $created_at);
$status = $sth->execute(); $status = $sth->execute();
} catch (PDOException $e) { } catch (\Exception $e) {
throw new TelegramException($e->getMessage()); throw new TelegramException($e->getMessage());
} }
return $status; return $status;
...@@ -178,7 +179,7 @@ class ConversationDB extends DB ...@@ -178,7 +179,7 @@ class ConversationDB extends DB
try { try {
$sth = self::$pdo->prepare($query); $sth = self::$pdo->prepare($query);
$status = $sth->execute($tokens); $status = $sth->execute($tokens);
} catch (PDOException $e) { } catch (\Exception $e) {
throw new TelegramException($e->getMessage()); throw new TelegramException($e->getMessage());
} }
return $status; return $status;
......
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