Information générale
Catégorie:
Code, syntaxe and commandes
Versions des environnements
Network:
Windows 2008 Server
>>I think the catch comment is probably badly worded. If the exception could truly be handled then re-throwing would be unnecessary. If it's only partially handled (eg logging or notifying the user) but is not recoverable then throwing to a higher level makes sense....
>
>But wouldn't you end up logging the error twice (assuming you have an error handler in the method above the one that had an exception, which you should, right?)
Yes. Maybe logging wasn't a good example. But sometimes there is more information available for logging when the initial exception is thrown (local values, etc.) - the alternative is to create a custom exception to retain those values and throw that. The latter is probably more 'correct' - but more work :-}
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement