Package org.javacord.api.exception
Class DiscordException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.javacord.api.exception.DiscordException
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
BadRequestException,MissingPermissionsException,RatelimitException
public class DiscordException extends Exception
This exception is always thrown whenever a request to Discord failed.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DiscordException(Exception origin, String message, RestRequestInformation request, RestRequestResponseInformation response)Creates a new instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Optional<RestRequestInformation>getRequest()Gets information about the request which caused the exception.Optional<RestRequestResponseInformation>getResponse()Gets information about the response which caused the exception.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
-
-
-
Constructor Detail
-
DiscordException
public DiscordException(Exception origin, String message, RestRequestInformation request, RestRequestResponseInformation response)
Creates a new instance of this class.- Parameters:
origin- The origin of the exception.message- The message of the exception.request- The information about the request.response- The information about the response.
-
-
Method Detail
-
getRequest
public Optional<RestRequestInformation> getRequest()
Gets information about the request which caused the exception. May benullif the exception was thrown before creating a request.- Returns:
- Information about the request which caused the exception.
-
getResponse
public Optional<RestRequestResponseInformation> getResponse()
Gets information about the response which caused the exception. May not be present if the exception was thrown before sending a request.- Returns:
- Information about the response which caused the exception.
-
-