New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Throw only specialized package-only exceptions #725
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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
15 changes: 15 additions & 0 deletions
15
lib/Doctrine/Migrations/Configuration/Connection/Loader/Exception/InvalidConfiguration.php
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Configuration\Connection\Loader\Exception; | ||
|
||
use InvalidArgumentException; | ||
|
||
final class InvalidConfiguration extends InvalidArgumentException implements LoaderException | ||
{ | ||
public static function invalidArrayConfiguration() : self | ||
{ | ||
return new self('The connection file has to return an array with database configuration parameters.'); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
lib/Doctrine/Migrations/Configuration/Connection/Loader/Exception/LoaderException.php
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,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Configuration\Connection\Loader\Exception; | ||
|
||
use Doctrine\Migrations\Exception\MigrationException; | ||
|
||
interface LoaderException extends MigrationException | ||
{ | ||
} |
15 changes: 15 additions & 0 deletions
15
lib/Doctrine/Migrations/Configuration/Exception/FileNotFound.php
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Configuration\Exception; | ||
|
||
use InvalidArgumentException; | ||
|
||
final class FileNotFound extends InvalidArgumentException implements ConfigurationException | ||
{ | ||
public static function new() : self | ||
{ | ||
return new self('Given config file does not exist'); | ||
} | ||
} |
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Exception; | ||
|
||
use RuntimeException; | ||
|
||
final class NoTablesFound extends RuntimeException implements MigrationException | ||
{ | ||
public static function new() : self | ||
{ | ||
return new self('Your database schema does not contain any tables.'); | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Exception; | ||
|
||
use RuntimeException; | ||
|
||
final class RollupFailed extends RuntimeException implements MigrationException | ||
{ | ||
public static function noMigrationsFound() : self | ||
{ | ||
return new self('No migrations found.'); | ||
} | ||
|
||
public static function tooManyMigrations() : self | ||
{ | ||
return new self('Too many migrations.'); | ||
} | ||
} |
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,9 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Finder\Exception; | ||
|
||
interface FinderException | ||
{ | ||
} |
16 changes: 16 additions & 0 deletions
16
lib/Doctrine/Migrations/Finder/Exception/InvalidDirectory.php
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,16 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Finder\Exception; | ||
|
||
use InvalidArgumentException; | ||
use function sprintf; | ||
|
||
final class InvalidDirectory extends InvalidArgumentException implements FinderException | ||
{ | ||
public static function new(string $directory) : self | ||
{ | ||
return new self(sprintf('Cannot load migrations from "%s" because it is not a valid directory', $directory)); | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
lib/Doctrine/Migrations/Finder/Exception/NameIsReserved.php
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,22 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Finder\Exception; | ||
|
||
use InvalidArgumentException; | ||
use const PHP_EOL; | ||
use function sprintf; | ||
|
||
final class NameIsReserved extends InvalidArgumentException implements FinderException | ||
{ | ||
public static function new(string $version) : self | ||
{ | ||
return new self(sprintf( | ||
'Cannot load a migrations with the name "%s" because it is a reserved number by Doctrine Migrations.' | ||
. PHP_EOL | ||
. "It's used to revert all migrations including the first one.", | ||
$version | ||
)); | ||
} | ||
} |
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
11 changes: 11 additions & 0 deletions
11
lib/Doctrine/Migrations/Generator/Exception/GeneratorException.php
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,11 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Generator\Exception; | ||
|
||
use Doctrine\Migrations\Exception\MigrationException; | ||
|
||
interface GeneratorException extends MigrationException | ||
{ | ||
} |
26 changes: 26 additions & 0 deletions
26
lib/Doctrine/Migrations/Generator/Exception/InvalidTemplateSpecified.php
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,26 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Generator\Exception; | ||
|
||
use InvalidArgumentException; | ||
use function sprintf; | ||
|
||
final class InvalidTemplateSpecified extends InvalidArgumentException implements GeneratorException | ||
{ | ||
public static function notFoundOrNotReadable(string $path) : self | ||
{ | ||
return new self(sprintf('The specified template "%s" cannot be found or is not readable.', $path)); | ||
} | ||
|
||
public static function notReadable(string $path) : self | ||
{ | ||
return new self(sprintf('The specified template "%s" could not be read.', $path)); | ||
} | ||
|
||
public static function empty(string $path) : self | ||
{ | ||
return new self(sprintf('The specified template "%s" is empty.', $path)); | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
lib/Doctrine/Migrations/Generator/Exception/NoChangesDetected.php
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,15 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Doctrine\Migrations\Generator\Exception; | ||
|
||
use RuntimeException; | ||
|
||
final class NoChangesDetected extends RuntimeException implements GeneratorException | ||
{ | ||
public static function new() : self | ||
{ | ||
return new self('No changes detected in your mapping information.'); | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is
, and simple quotes?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@greg0ire Some of the messages would indeed benefit from rewording, mind to send a PR? ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will do!