[2.2][Routing] Normalize exceptions in Routing Component #5544

Closed
wants to merge 1 commit into
from

Conversation

Projects
None yet
4 participants
Member

romainneutron commented Sep 18, 2012

Bug fix: no
Feature addition: no
Backwards compatibility break: no
Symfony2 tests pass: yes
License of the code: MIT

Exceptions are now normalized inside the Routing Component and implement Symfony\Component\Routing\Exception\ExceptionInterface

Member

Tobion commented Sep 18, 2012

Why is that necessary and what is it good for?

Member

stof commented Sep 18, 2012

@Tobion we agreed 1 year ago about using component specific exceptions, but existing components were not all converted to this way.

Member

romainneutron commented Sep 18, 2012

BTW Travis build fails on upstream error, tests are ok in the routing scope on my local clone

Member

Tobion commented Sep 18, 2012

@stof but what is it good for? There good reasons to create sub-classes for special exceptions like RouteNotFoundException. But I see no point in duplicating all SPL exceptions for all components.
Thats like 23 components * 13 SPL exceptions = 299 redundant classes.

Member

romainneutron commented Sep 18, 2012

It allows you catching an exception by scope. This is often used in some lib like Imagine or ZF2

Member

Tobion commented Sep 18, 2012

How is it useful to catch an exception like one raised by the RouteCompiler? There is reason why the exception is thrown because there is no way to proceed and the code needs to be fixed. Even if you catch a LogicException you still don't know what excactly was the problem because there are several errors that lead to an LogicException. So you cannot fix it automatically anyway.

Member

romainneutron commented Oct 16, 2012

@fabpot what about this ? I was going to normalize components exceptions (scope exceptions per component). If it's not something required for symfony, let's close this one. Otherwise, I'll check the other components in a near future

Owner

fabpot commented Oct 17, 2012

I tend to agree with @Tobion here. Indeed, we decided to use specific exceptions in components, but only when it makes sense. Converting all components to use specific exceptions is not desirable if there is no point in doing that. So, I'm closing this PR.

fabpot closed this Oct 17, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment