Skip to content
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

[Config][Exception] Improve Routing Syntax Import Error #11313

Merged
merged 6 commits into from Aug 28, 2014

Conversation

JanDC
Copy link
Contributor

@JanDC JanDC commented Jul 5, 2014

Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #11300
License MIT
Doc PR n/a

$message .= ' ' . sprintf('%s', $trimmedMessage) . ' in ';
} else {
$message .= ' ' . sprintf('%s', $previous->getMessage()) . ' in ';
}
Copy link
Member

Choose a reason for hiding this comment

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

This is removing a trailing period from the previous exception message if there is one:

Unable to parse at line 5 (near "pattern /").

Becomes just:

Unable to parse at line 5 (near "pattern /")

It looks a little hacky, but it makes sense. I think we should at least add a comment here about what we're doing - I had to stare at this for a minute :).

@weaverryan
Copy link
Member

I think you did a great job! But now I kind of think this exception class needs a test to test for these different message possibilities!

* @param string $resource The resource that could not be imported
* @param string $sourceResource The original resource importing the new resource
* @param int $code The error code
* @param \Exception $previous A previous exception
Copy link
Member

Choose a reason for hiding this comment

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

These changes should be reverted (AFAICS, you just removed spaces here.)

@JanDC
Copy link
Contributor Author

JanDC commented Jul 7, 2014

Hi @weaverryan ,
should it be necessary to cover those different messages in a test? Given the fact that it's still the same exception being thrown, only with the message presented differently...

@stof
Copy link
Member

stof commented Jul 7, 2014

given that we have some logic in there, it should be tested IMO, to ensure that the code is not broken

@tvlooy
Copy link
Contributor

tvlooy commented Jul 8, 2014

@JanDC is my colleague, we talked about adding this test

JanDC and others added 2 commits July 9, 2014 10:11
modified FileLoaderLoadException message to present the previous (Parse)Exception first
@tvlooy
Copy link
Contributor

tvlooy commented Jul 9, 2014

we rebased and squashed some commits

@tvlooy
Copy link
Contributor

tvlooy commented Jul 22, 2014

@stof this is ready to be merged imo /cc @JanDC

@@ -0,0 +1,74 @@
<?php

namespace Symfony\Component\Config\Tests\Exception;
Copy link
Contributor

Choose a reason for hiding this comment

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

Missing license note.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for noticing @stloyd
@stof, it's now ready to be merged :) /cc @tvlooy

@tvlooy
Copy link
Contributor

tvlooy commented Jul 22, 2014

👍

$message .= sprintf(
'(which is being imported from "%s")',
$this->varToString($sourceResource)
);
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 move everything on one line here?

@fabpot
Copy link
Member

fabpot commented Jul 23, 2014

👍

@JanDC
Copy link
Contributor Author

JanDC commented Aug 2, 2014

Hey @stof / @fabpot ,
I think it's ready to be merged by now...

@fabpot
Copy link
Member

fabpot commented Aug 28, 2014

ping @symfony/deciders

@lsmith77
Copy link
Contributor

+1

@fabpot
Copy link
Member

fabpot commented Aug 28, 2014

Thank you @JanDC.

@fabpot fabpot merged commit fec9a4a into symfony:master Aug 28, 2014
fabpot added a commit that referenced this pull request Aug 28, 2014
…r (Jan Decavele, tvlooy)

This PR was merged into the 2.6-dev branch.

Discussion
----------

[Config][Exception] Improve Routing Syntax Import Error

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #11300
| License       | MIT
| Doc PR        | n/a

Commits
-------

fec9a4a removed some more spaces
16134d9 Merge remote-tracking branch 'upstream/master'
b099936 - Removed spaces around the concation dots to be more consitent - adjusted some formatting
0459d89 Addition of the symfony license text
de43182 Add test and small code fix
8ac5275 ISSUE #11300: Improve Routing Syntax Import Error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants