Properly fixed exceptions

This commit is contained in:
Stephen Hoogendijk
2015-07-23 09:40:41 +02:00
parent e7c6630329
commit a6b4616d0d
2 changed files with 5 additions and 3 deletions
+1 -1
View File
@@ -170,7 +170,7 @@ class Client
return $driver->query();
} catch (\Exception $e) {
throw new Exception(sprintf('Query has failed, exception: %s', $e->getMessage()));
throw new Exception('Query has failed', $e->getCode(), $e);
}
}
+4 -2
View File
@@ -93,7 +93,9 @@ class Database
}
} catch (\Exception $e) {
throw new DatabaseException(
sprintf('Failed to created database %s, exception: %s', $this->name, $e->getMessage())
sprintf('Failed to created database %s', $this->name),
$e->getCode(),
$e
);
}
}
@@ -138,7 +140,7 @@ class Database
return $driver->isSuccess();
} catch (\Exception $e) {
throw new Exception(sprintf('Writing has failed, exception: %s', $e->getMessage()));
throw new Exception('Writing has failed', $e->getCode(), $e);
}
}