Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[Workflow] implemented TransitionException to be thrown instead of Logic exception#26587

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Closed
andrewtch wants to merge1 commit intosymfony:masterfromandrewtch:transition-exception-for-workflow
Closed

[Workflow] implemented TransitionException to be thrown instead of Logic exception#26587

andrewtch wants to merge1 commit intosymfony:masterfromandrewtch:transition-exception-for-workflow

Conversation

@andrewtch
Copy link
Contributor

QA
Branch?master
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets
LicenseMIT
Doc PR

Getting Logic exception from Workflow is somehow confusing - as there is no way to understand which transition triggered the exception, and there's no access to the subject being modified to format the exception in any other way.

Therefore, I've implemented TransitionException to be thrown at runtime (extending current LogicException to avoid BC).getMessage signature remains the same. All other exceptions are untouched (as they are tied to very logic of the workflow, and to to the subject).

See#26581

@nicolas-grekasnicolas-grekas changed the titleimplemented TransitionException to be thrown instead of Logic exception[Workflow] implemented TransitionException to be thrown instead of Logic exceptionMar 19, 2018
@nicolas-grekasnicolas-grekas added this to the4.1 milestoneMar 19, 2018
/**
* @author Andrew Tch <andrew.tchircoff@gmail.com>
*/
class TransitionException extends \LogicException implements ExceptionInterface

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

could it extend LogicException from the Workflow namespace? this would prevent a BC break

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Oh, so sorry - that was intended to have implement it to avoid BC. Fixed, added a simple test case also.

/**
* @author Andrew Tch <andrew.tchircoff@gmail.com>
*/
class TransitionException extends LogicException implements ExceptionInterface

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

implements ExceptionInterface (since already implemented byLogicException now :)

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Done. Sorry, my coding style is chaotic somehow )

@lyrixx
Copy link
Member

Hello@andrewtch

Thanks for your PR but unfortunately, It's already implemented in#26076

@andrewtch
Copy link
ContributorAuthor

@lyrixx , I don't see how I can understand what transition actually caused the exception. Your's UndefinedTransictionException (https://github.com/symfony/symfony/pull/26076/files#diff-edae21a7fe491af4f1bfd5519f01d722) still falls back to simple string.

@andrewtch
Copy link
ContributorAuthor

Can we merge this together to provide a trusted way to differentiate exceptions?

@lyrixx
Copy link
Member

Ok, we will do that ;)

@xabbuh
Copy link
Member

@andrewtch Can you resolve the conflicts here?

@lyrixx
Copy link
Member

@andrewtch If you miss some time to finish this PR before the feature freeze, I can finish it for you. Don't hesitate to tell me.

@lyrixx
Copy link
Member

Thanks@andrewtch for working on this feature.
The feature freeze is almost here. That's why I finished your PR:#26651

@lyrixxlyrixx closed thisMar 23, 2018
lyrixx added a commit that referenced this pull requestMar 23, 2018
…ixx)This PR was merged into the 4.1-dev branch.Discussion----------[Workflow] Added a TransitionException| Q             | A| ------------- | ---| Branch?       | master| Bug fix?      | no| New feature?  | yes| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#26587#26581| License       | MIT| Doc PR        |---Note for reviewer: `NotEnabledTransitionException` and `UndefinedTransitionException` were not released. So this is not a BC Break.Commits-------838548c Finished implementation of TransitionException9fa4f79 implemented TransitionException to be thrown instead of Logic exception
/**
* @return string
*/
public function getTransitionName()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

we could use a return type hint here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

You commented a closed pr :-)

/**
* @return string
*/
public function getWorkflowName()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

same here

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@nicolas-grekasnicolas-grekasnicolas-grekas left review comments

@lyrixxlyrixxlyrixx left review comments

@xabbuhxabbuhxabbuh left review comments

Assignees

No one assigned

Labels

Projects

None yet

Milestone

4.1

Development

Successfully merging this pull request may close these issues.

4 participants

@andrewtch@lyrixx@xabbuh@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp