Patrick ALLAERT wrote on 24/04/2016 14:18:
There is just nothing more repeatable or common cases than "resource not
found", "method not allowed", "access denied",... They are all non
exceptional cases better handled without exceptions and with clean APIs
reflecting the business logic of the application.

I think part of the problem may be that non-trivial examples require rather a lot of context. An example that comes to my mind is if an application is combining a bunch of different libraries, and calling them all in sequence:

try
{
$fooService->doStuff($data);
$barService->doMoreStuff($data);
$bazService->doDifferentStuff($data);
}
catch ( FooException | BarException | BazException $e )
{
// We don't care which library threw the exception, the action is always the same throw new AppException($e); // Hide which libraries we're using to implement the function
}

Regards,
--
Rowan Collins
[IMSoP]

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to