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

[Messenger] Add FlattenException Normalizer#37087

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

Merged

Conversation

@monteiro
Copy link
Contributor

@monteiromonteiro commentedJun 3, 2020
edited
Loading

QA
Branch?master
Bug fix?no
New feature?yes
Deprecations?no
TicketsFix#32719 ...
LicenseMIT
Doc PRNo docs ...

I have just duplicated the PR#33650 (from@skalpa) but using the new component ErrorHandler and removing the priority.

Project that reproduces the bug on Symfony 5.2:https://github.com/monteiro/serializer-pr37087 (all steps are on the README).

Since this adds a new class and changes behavior, we add this new feature on the 5.2 branch.

@monteiromonteiro requested a review fromdunglas as acode ownerJune 3, 2020 16:03
@monteiromonteiro changed the titleAdd FlattenException Normalizer[Fix] Add FlattenException NormalizerJun 3, 2020
@monteiro
Copy link
ContributorAuthor

I still need to test well the priority, because it works on my symfony 5.0 (without it), but I want to try it on Symfony 4.4 to see if I have the same behavior.

Copy link
Contributor

@ro0NLro0NL left a comment

Choose a reason for hiding this comment

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

API platform normalizes FlattenException at a very low prio, is it an issue?

@nicolas-grekasnicolas-grekas changed the title[Fix] Add FlattenException Normalizer[Serializer] Add FlattenException NormalizerJun 4, 2020
@nicolas-grekasnicolas-grekas added this to the4.4 milestoneJun 4, 2020
@monteiro
Copy link
ContributorAuthor

monteiro commentedJun 4, 2020
edited
Loading

I have 2 unit tests failing:

There were 2 errors:1) Symfony\Component\Serializer\Tests\Normalizer\FlattenExceptionNormalizerTest::testNormalize with data set "instance from constructor" (Symfony\Component\ErrorHandler\Exception\FlattenException Object (...))TypeError: Return value of Symfony\Component\ErrorHandler\Exception\FlattenException::getMessage() must be of the type string, null returned/home/travis/build/symfony/symfony/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php:190/home/travis/build/symfony/symfony/src/Symfony/Component/Serializer/Normalizer/FlattenExceptionNormalizer.php:37/home/travis/build/symfony/symfony/src/Symfony/Component/Serializer/Tests/Normalizer/FlattenExceptionNormalizerTest.php:462) Symfony\Component\Serializer\Tests\Normalizer\FlattenExceptionNormalizerTest::testDenormalizeValidDataTypeError: Return value of Symfony\Component\ErrorHandler\Exception\FlattenException::getMessage() must be of the type string, null returned/home/travis/build/symfony/symfony/src/Symfony/Component/ErrorHandler/Exception/FlattenException.php:190/home/travis/build/symfony/symfony/src/Symfony/Component/Serializer/Tests/Normalizer/FlattenExceptionNormalizerTest.php:93

@nicolas-grekas Maybe you can help me with this. I know that on theFlattenException Unit tests you never use the constructor without arguments.

You did the change in thepast adding typehints to the FlattenException class methods, which makes total sense when you are creating this exception from throwable. But what can we do in this specific case?

Should I still use the empty constructorhere or should I use reflection?

If I use it, makes sense to test the empty constructor but since they have different type hints from the getters (Example: message is null in the empty constructor, but getMessage() has a string typehint) the test fails.

Or should I follow the FlattenException unit tests and remove the empty constructor test?

Note: This does not happen in this specific feature, because the normalizer does not call any getter without a full FlattenException.

@monteiromonteiroforce-pushed theflatten-exception-denormalizer branch from459b375 toa5aae27CompareAugust 9, 2020 14:42
@monteiromonteiroforce-pushed theflatten-exception-denormalizer branch froma5aae27 to6c1b966CompareAugust 9, 2020 15:00
@monteiromonteiroforce-pushed theflatten-exception-denormalizer branch from6c1b966 to0981943CompareAugust 20, 2020 07:38
Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

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

I understand the reasoning. That works for me.

@monteiromonteiroforce-pushed theflatten-exception-denormalizer branch fromc39cb1b toc528a31CompareAugust 21, 2020 13:44
@monteiromonteiro changed the base branch from4.4 tomasterAugust 21, 2020 13:44
@monteiromonteiro requested a review fromfabpotAugust 21, 2020 14:26
@monteiromonteiro changed the title[Serializer] Add FlattenException Normalizer[Messenger] Add FlattenException NormalizerAug 21, 2020
@fabpot
Copy link
Member

Tests need to be updated to pass.

monteiro reacted with thumbs up emoji

@monteiro
Copy link
ContributorAuthor

@fabpot I have updated the tests but some Travis tests are failing with the error that the FlattenExceptionNormalizer class does not exist (FrameworkBundle is fetching v5.0 in Travis).

I suppose that will only be green when we merge this or am I missing something?

Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

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

Tests are broken because of the constraints in composer.json. I will fix it while merging.

@fabpotfabpotforce-pushed theflatten-exception-denormalizer branch fromc91b71a to78fbd0aCompareAugust 23, 2020 08:56
@fabpot
Copy link
Member

Thank you@monteiro.

monteiro reacted with thumbs up emojimonteiro reacted with rocket emoji

@fabpotfabpot merged commit12f8631 intosymfony:masterAug 23, 2020
@xabbuhxabbuh modified the milestones:4.4,nextAug 27, 2020
@nicolas-grekasnicolas-grekas modified the milestones:next,5.2Oct 5, 2020
@fabpotfabpot mentioned this pull requestOct 5, 2020
@monteiromonteiro deleted the flatten-exception-denormalizer branchDecember 5, 2020 09:21
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

@dunglasdunglasAwaiting requested review from dunglas

@nicolas-grekasnicolas-grekasAwaiting requested review from nicolas-grekas

@jderussejderusseAwaiting requested review from jderusse

@lyrixxlyrixxAwaiting requested review from lyrixx

@srozesrozeAwaiting requested review from sroze

@xabbuhxabbuhAwaiting requested review from xabbuh

+2 more reviewers

@ro0NLro0NLro0NL left review comments

@YaFouYaFouYaFou left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Projects

None yet

Milestone

5.2

Development

Successfully merging this pull request may close these issues.

[Messenger] Message retried in failure transport dropped on exception

7 participants

@monteiro@fabpot@nicolas-grekas@ro0NL@YaFou@xabbuh@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp