-1

javax.mail has an exception SendFailedException, but the 'Failed' word seems to be redundant because the work 'Exception' implies failure anyway?

Question: Is the 'Failed' word redundant? Please provide supporting facts with your answer to keep this question on topic.


I have searched using google and found a few resources, but nothing that specifically answers my question:

Community
  • 1
  • 1
Chris Snow
  • 23,813
  • 35
  • 144
  • 309
  • Why the down vote and close vote? I've tried to make sure this question fits SO's guidance [here](http://stackoverflow.com/help/on-topic) and [here](http://stackoverflow.com/help/dont-ask). This is a question about 'Coding techniques', and it is also asking for fact based answers to avoid 'polls, opinions, and discussions'. Please give me some tips where I am going wrong! – Chris Snow Feb 04 '14 at 06:57
  • maybe programmers.stackexchange.com would be more receptive to coding conventions type questions :) – Sameera Feb 05 '14 at 05:36

1 Answers1

1

If you look at the other types of MessagingException, you'll see the same pattern:

AuthenticationFailedException
FolderClosedException
FolderNotFoundException
...
SendFailedException
etc.

Basically, there are a set of things that can go wrong (authentication failed, folder not found, etc.) when sending a message, and the names of those conditions (AuthenticationFailed, FolderNotFound) may (initially in 1998, or even today) have come from a lower layer, possibly native code that looked like:

// Reasons for messaging failure:
#define AuthenticationFailed -42
// etc.

You certainly wouldn't expect to see "Send" in this list. You'd expect "SendFailed".

And when the failure conditions were made into exceptions, they just appended the word 'Exception' to the existing names.

That's my theory, anyway.

John Visosky
  • 237
  • 1
  • 1