-
Notifications
You must be signed in to change notification settings - Fork 89
Catch statement in service manager should handle any exception code #41
Comments
Whole story to this point is writte in the first comment here: http://php.net/manual/en/class.pdoexception.php Question to be asked is: |
As I've said on IRC, I'll not loose my time with PHP dev team by reporting bugs on their bug tracker due to their EGO (and so on...). For the record
In short: The PHP dev team does not hesitate to violate its own interfaces (by laziness?) |
Not really, it's mostly because many of the core members of PHP-DEV are still attached to very old practices that aren't really considered "good" anymore. |
This looks like it has been forgotten. Is this still an issue to resolve? |
You mean in ZF3? I don't know. Even through, we can handle this problem locally by catching the exception. |
@nuxwin Thanks for responding. I was talking specifically in ZF2. I am looking for some easy issues to fix. I am new to contributing to open source :) |
Not the best issue to start ;) From my point of view, this issue can be closed. |
Why would you catch any exceptions in the service manager and re-throw generic, useless exceptions instead of leaving the proper exceptions to bubble up and be caught as needed by the user? If I had a penny for everytime the useless exceptions from the service manager were thrown and I had no clue what went wrong, I'd be rich. Maybe you should reconsider this in the future. |
You can rely on this type from a caller in order to wrap the DIC and write fallback logic. If everything was a If the problem is dealing with "previous exceptions", then my suggestions is to get up to speed with that concept, and quickly, since most good OO libraries out there do wrap exceptions in known failure scenarios. |
Anyway, if anybody wants to pick this up, write a test with a factory that does something like this: (function (Potato $foo) {})();
```
Then verify that the type of the error is indeed a `ServiceNotCreated`. |
This repository has been closed and moved to laminas/laminas-servicemanager; a new issue has been opened at laminas/laminas-servicemanager#26. |
Hello ;
I've a service factory like this:
Here, if an error occurs, a PDOException is throw. The problem is that the underlying catch statement from the service manager don't handle PDOException code and thus, the following fatal error is raised:
Note: Here the wrong query SET NAMESS is intentional.
The text was updated successfully, but these errors were encountered: