Throw exception when server is not available

836 Views Asked by At

I am working with the bugsense SDK and want to be aware if my API backend goes down. Exception information is obligatory. I have searched the Java Exception library for exceptions related to server availability but could not find any.

Are there any Exceptions from Java or Android related to this? If not would it be advisable to create my own Exception class?

2

There are 2 best solutions below

0
On BEST ANSWER

You can create your own. You can extend Exception class. Something like:

class YourException extends Exception
{
}
0
On

Just create your own. Doing so is trivial, just extend Exception.