Skip to content
This repository has been archived by the owner on Sep 20, 2019. It is now read-only.

Commit

Permalink
Merge f7a094e into 04aca65
Browse files Browse the repository at this point in the history
  • Loading branch information
JeroenDeDauw committed Mar 29, 2014
2 parents 04aca65 + f7a094e commit 8db4614
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/PDO/PDOTableBuilder.php
Expand Up @@ -43,10 +43,20 @@ public function createTable( TableDefinition $table ) {
$result = $this->pdo->query( $this->tableSqlBuilder->getCreateTableSql( $table ) );

if ( $result === false ) {
throw new TableCreationFailedException( $table );
throw new TableCreationFailedException( $table, $this->getErrorMessage() );
}
}

private function getErrorMessage() {
$errorInfo = $this->pdo->errorInfo();

if ( is_array( $errorInfo ) ) {
return $errorInfo[2];
}

return '';
}

/**
* @see TableBuilder::dropTable
*
Expand All @@ -60,7 +70,7 @@ public function dropTable( $tableName ) {
$result = $this->pdo->query( 'DROP TABLE ' . $tableName . ';' );

if ( $result === false ) {
throw new TableDeletionFailedException( $tableName );
throw new TableDeletionFailedException( $tableName, $this->getErrorMessage() );
}
}

Expand Down

0 comments on commit 8db4614

Please sign in to comment.