IOException
has its own meaning. An IOException
should be only thrown when there as an issue in IO operations e.g. reading/writing data from file or URL. If I have to make choice between the two, I will choose ServletExcetion
.
But if there is a room to define better exception handling then I would like to create my own custom exception class e.g. MySystemException
extending RuntimeException
and wrap the relevant exceptions as MySystemException
and throw it.