I am using paris orm to develop a web application. I am adding data to the database and it fails, when i use a try catch block to catch the error it doesnt work.
My configurations are
ORM::configure('mysql:host='.DB_HOST.';dbname='.DB_NAME);
ORM::configure('username',DB_USER);
ORM::configure('password',DB_PASSWORD);
ORM::configure('logging', true);
ORM::configure('error_mode', PDO::ERRMODE_EXCEPTION);
The insertion code
try {
$dataToStore = SessionData::create();
$dataToStore->usession_sessioncode = $sessionCode;
$dataToStore->usessdata_content = $dataString;
$dataToStore->save();
} catch (PDOException $e) {
echo $e->getMessage();
} catch (Exception $e) {
echo $e->getMessage();
}
Really looked for a solution around but no one gives a clear answer. I want to be to catch the exception and know were the error is exactly.