-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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 exception if sequence generator not found #1500
Throw exception if sequence generator not found #1500
Conversation
|
||
continue; | ||
} | ||
$generator = $this->registry->get($entity); |
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.
I would actually catch the generic exception and throw a sequence-specific one, easier to debug and control.
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.
I know. I was lazy 👅
That's efficiency! |
@@ -29,7 +29,7 @@ public function getId(); | |||
public function getName(); | |||
|
|||
/** | |||
* @param string $name | |||
* @param string $name |
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.
I see you run CS fixer... and again it fails with such changes =)
Correct one is new line between @param
& @return
.
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.
Yep :)
{ | ||
public function __construct($entity, NonExistingServiceException $e) | ||
{ | ||
parent::__construct(sprintf('Generator for entity "%s" does not exist.', get_class($entity)), 0, $e); |
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.
We can be even clearer in the exception message:
... You must add it in your sylius.yml configuration file. For example: sylius_sequence.generators.%s: sylius.sequence.sequential_number_generator
And replace the 0
by $e->getCode()
;)
Throw exception if sequence generator not found
That was buggin me as well, thanks guys! |
No description provided.