-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nullable sub/sup entity must not throw an error!
- Loading branch information
Showing
17 changed files
with
466 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?php declare(strict_types=1); | ||
|
||
namespace Zrnik\MkSQL\Exceptions; | ||
|
||
use Throwable; | ||
|
||
class TableCreationFailedException extends MkSQLException | ||
{ | ||
public function __construct( | ||
string $tableName, ?string $columnName, string $query, Throwable $previous | ||
) | ||
{ | ||
|
||
$reason = $previous->getMessage(); | ||
|
||
$message = $columnName === null | ||
? sprintf( | ||
"Unable to create table '%s'\nreason: %s\nquery: %s", | ||
$tableName, $reason, $query | ||
) | ||
: sprintf( | ||
"Unable to create column '%s::%s'\nreason: %s\nquery: %s", | ||
$tableName, $columnName, $reason, $query | ||
); | ||
|
||
parent::__construct($message, (int) $previous->getCode(), $previous); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.