Skip to content

[ErrorRenderer] Add DebugCommand for easy debugging and testing #32504

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

Merged
merged 1 commit into from
Aug 1, 2019

Conversation

yceruto
Copy link
Member

@yceruto yceruto commented Jul 11, 2019

Q A
Branch? 4.4
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -
License MIT
Doc PR -

debug-error-renderer

This command helps you test built-in renderers and others provided by third-party packages (thinking API-Platform, FOSRestBundle, etc.) without requiring the TwigBundle preview mechanism.

This also fixes a bug in ErrorRendererPass related to the order of priorities.

@yceruto yceruto force-pushed the debug_command branch 4 times, most recently from 33b2036 to dc0f057 Compare July 11, 2019 22:27
@yceruto yceruto added this to the next milestone Jul 11, 2019
protected function configure(): void
{
$this
->addArgument('format', InputArgument::OPTIONAL, sprintf('Outputs a sample in a specific format (one of %s)', implode(', ', array_keys($this->renderers))))
Copy link
Member

Choose a reason for hiding this comment

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

Should be an option to be consistent with other commands.

Copy link
Member Author

@yceruto yceruto Jul 12, 2019

Choose a reason for hiding this comment

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

Here "format" doesn't have the same meaning as in other commands. Other commands use the --format option to show the current information in another format, here the format argument shows a different information with a different meaning "Outputs an error sample in a specific format".

It could also be confusing because people would expect that with --format=json the list of available renderers in the specified format and that is not the case.

Do you think the description of the argument should be improved to make it clearer?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is rather "I want to see an output of the error renderer associated with this format".

Copy link
Member Author

Choose a reason for hiding this comment

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

@fabpot is this thread still a blocker?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think having this as argument makes sense in this case.

@yceruto
Copy link
Member Author

yceruto commented Jul 16, 2019

Thanks @ro0NL !

(Status: Needs Review)

Tobion added a commit that referenced this pull request Jul 22, 2019
…nderers registration (yceruto)

This PR was merged into the 4.4 branch.

Discussion
----------

[ErrorRenderer] Fixed the priority order of the error renderers registration

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Spotted in #31398 and #32504

Commits
-------

710b51d Fixed the priority order of the error renderers registration
@yceruto yceruto force-pushed the debug_command branch 2 times, most recently from 54e45b0 to 5a0845c Compare July 25, 2019 15:31
@Tobion
Copy link
Contributor

Tobion commented Aug 1, 2019

Thank you @yceruto.

@Tobion Tobion merged commit 97c8968 into symfony:4.4 Aug 1, 2019
Tobion added a commit that referenced this pull request Aug 1, 2019
…d testing (yceruto)

This PR was squashed before being merged into the 4.4 branch (closes #32504).

Discussion
----------

[ErrorRenderer] Add DebugCommand for easy debugging and testing

| Q             | A
| ------------- | ---
| Branch?       | 4.4
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

![debug-error-renderer](https://user-images.githubusercontent.com/2028198/61086533-170a8a00-a401-11e9-89a6-3b8195ba80c1.gif)

This command helps you test built-in renderers and others provided by third-party packages (thinking API-Platform, FOSRestBundle, etc.) without requiring the TwigBundle preview mechanism.

<del>This also fixes a bug in `ErrorRendererPass` related to the order of priorities.</del>

Commits
-------

97c8968 [ErrorRenderer] Add DebugCommand for easy debugging and testing
@yceruto yceruto deleted the debug_command branch August 1, 2019 19:11
@nicolas-grekas nicolas-grekas modified the milestones: next, 4.4 Oct 27, 2019
This was referenced Nov 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants