12. can be avoided
should directly lead to a fix
message is more important than type
very important in libraries
should not be catched
examples:
wrong argument type / value
calling method in incorrect order
creating an instance of static class
calling not implemented method
13. can NOT be avoided
type is more important than message
should be catched
often related to thread safety
examples:
file / directory / database entry not found
duplicate entry in database
18. throw only exceptions from your namespace
usage error
write nice ex. message for human developer
runtime error
use very specific type
(often requires creating a new one)
message is often useless
phpDoc
Always specify all runtime exceptions
@throw annotation is part of API
19. never display ex. message to the user
catch as specific types as possible
read and respect @throw annotations
use $previous when rethrowing ex.