Skip to content

[WIP][Form] Improve transformation failure message by providing property path #11318

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

Closed
wants to merge 3 commits into from
Closed

[WIP][Form] Improve transformation failure message by providing property path #11318

wants to merge 3 commits into from

Conversation

jubianchi
Copy link
Contributor

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

@@ -37,7 +37,7 @@ public function reverseTransform($value)
$result = array_search($value, $this->mapping, true);

if ($result === false) {
throw new RuntimeException(sprintf('No reverse mapping for value "%s"', $value));
throw new TransformationFailedException(sprintf('No reverse mapping for value "%s"', $value));
Copy link
Member

Choose a reason for hiding this comment

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

Interesting - it seems that this test class should have always thrown this (i.e. it was a minor bug in the test I think). Unless I'm missing something, nice work!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I said myself the same when reading the code :)

@jubianchi jubianchi changed the title [WIP][Form] Improve transformation failure mesasge by providing property path [WIP][Form] Improve transformation failure message by providing property path Jul 5, 2014
}
} catch (TransformationFailedException $exception) {
throw new TransformationFailedException(
'Unable to transform value for property path "' . $this->getPropertyPath() . '": ' . $exception->getMessage(),
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 a reverse transform now, I guess we could say "reverse" here :)

@stof
Copy link
Member

stof commented Jul 8, 2014

👍

1 similar comment
@fabpot
Copy link
Member

fabpot commented Jul 8, 2014

👍

@fabpot
Copy link
Member

fabpot commented Jul 8, 2014

Thank you @jubianchi.

@fabpot fabpot closed this Jul 8, 2014
fabpot added a commit that referenced this pull request Jul 8, 2014
…providing property path (jubianchi)

This PR was squashed before being merged into the 2.6-dev branch (closes #11318).

Discussion
----------

[WIP][Form] Improve transformation failure message by providing property path

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

Commits
-------

d56b7be [WIP][Form] Improve transformation failure message by providing property path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants