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

[Console] Add domain exceptions to replace generic exceptions#14894

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
GromNaN wants to merge5 commits intosymfony:2.8fromGromNaN:console-exception

Conversation

@GromNaN
Copy link
Member

Creates domain specific exception classes for the case where a user type an invalid command name or option name.

QA
Bug fix?no
New feature?yes
BC breaks?no
Deprecations?no
Tests pass?yes
Fixed tickets#14873
LicenseMIT
Doc PRN/A

TODO:

  • Replace\InvalidArgumentException bySymfony\Component\Console\Exception\InvalidArgumentException
  • AddSymfony\Component\Console\Exception\ExceptionInterface

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

I'm not sure this is the correct behavior. The line is wrapped, but not the class name, and the rest of the line is filled with spaces.

Copy link
Member

Choose a reason for hiding this comment

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

I thinkd should be on the same line asdefine.

@GromNaNGromNaN changed the title[Console] Add CommandNotDefinedException to replace generic exception[Console] Add domain exceptions to replace generic exceptionsJun 6, 2015
@GromNaN
Copy link
MemberAuthor

Any idea how to fix this failing test ?
https://travis-ci.org/symfony/symfony/jobs/65716176#L438

 1) Symfony\Component\Console\Tests\ApplicationTest::testFindAlternativeNamespace Failed asserting that Array &0 (    0 => 'foo'    1 => 'foo1'    2 => 'foo3') is identical to Array &0 (    0 => 'foo3'    1 => 'foo1'    2 => 'foo'). /home/travis/build/symfony/symfony/src/Symfony/Component/Console/Tests/ApplicationTest.php:444

@phansys
Copy link
Contributor

AFAIK, the alternative names was originallyordered withlevenshtein(), but I don't know if your issue is related to this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please, check missing new lines at EOFs.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Fixed.

Copy link
Member

Choose a reason for hiding this comment

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

Missing leading \ on all@expectedException tags

Copy link
Member

Choose a reason for hiding this comment

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

Can you fix this? We are using a leading\ everywhere else in Symfony for such PHPUnit annotations.

@fabpot
Copy link
Member

As you are moving exceptions to specific ones, what about doing it for the whole component?

@fabpot
Copy link
Member

@GromNaN Any news on this one? Can you address the comments?

@GromNaN
Copy link
MemberAuthor

OK for moving remaining exception to specific ones. Is it necessary to keep the distinction betweenInvalidArgumentException andLogicException in classes likeConsole/Question/Question ?

@fabpot
Copy link
Member

Yes, I think we need to keep the distinction here (at least to keep BC).

@GromNaN
Copy link
MemberAuthor

I'll createSymfony\Component\Console\Exception\InvalidArgumentException andSymfony\Component\Console\Exception\LogicException

And the interfaceSymfony\Component\Console\Exception\ExceptionInterface

Replace exception thrown by specific exception implementing thesame interface.
@GromNaN
Copy link
MemberAuthor

Rebased and made all changes.

I still have this error on HHVM :

1) Symfony\Component\Console\Tests\ApplicationTest::testFindAlternativeNamespaceFailed asserting that Array &0 (    0 => 'foo'    1 => 'foo1'    2 => 'foo3') is identical to Array &0 (    0 => 'foo3'    1 => 'foo1'    2 => 'foo').

Copy link
Member

Choose a reason for hiding this comment

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

I would have named itCommandNotFoundException to be more consistent with other exception names in other components.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

That's close to theRouteNotFoundException from the Routing component. Have you something in mind ?

Copy link
Member

Choose a reason for hiding this comment

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

CommandNotFoundException

@fabpot
Copy link
Member

I made some minor comments, but I'm 👍 on this change.

ping @symfony/deciders

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Here I've replaced the only instance of the basic\Exception by a more preciseLogicException.

@dunglas
Copy link
Member

👍

@fabpot
Copy link
Member

Thank you@GromNaN.

@xabbuh
Copy link
Member

@GromNaN I had a look at the failing tests:#15940

fabpot added a commit that referenced this pull requestSep 27, 2015
…test (xabbuh)This PR was merged into the 2.8 branch.Discussion----------[Console] don't rely on internal sort implementation om test| Q             | A| ------------- | ---| Bug fix?      | yes| New feature?  | no| BC breaks?    | no| Deprecations? | no| Tests pass?   | yes| Fixed tickets |#14894| License       | MIT| Doc PR        |PHP does not guarantuee how array elements with the same value will besorted when applying `asort()`. Since all namespaces used in the testproduce the same Levenshtein value, we should only check for presence ofthese namespaces instead of comparing the exact order.Commits-------3011fa0 don't rely on internal sort implementation in test
@fabpotfabpot mentioned this pull requestNov 16, 2015
@GromNaNGromNaN deleted the console-exception branchNovember 16, 2015 15:14
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

5 participants

@GromNaN@phansys@fabpot@dunglas@xabbuh

[8]ページ先頭

©2009-2025 Movatter.jp