Package org.javacord.api.exception
Class DiscordException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- org.javacord.api.exception.DiscordException
-
- All Implemented Interfaces:
java.io.Serializable
- Direct Known Subclasses:
BadRequestException,MissingPermissionsException,RatelimitException
public class DiscordException extends java.lang.ExceptionThis exception is always thrown whenever a request to Discord failed.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description DiscordException(java.lang.Exception origin, java.lang.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 java.util.Optional<RestRequestInformation>getRequest()Gets information about the request which caused the exception.java.util.Optional<RestRequestResponseInformation>getResponse()Gets information about the response which caused the exception.
-
-
-
Constructor Detail
-
DiscordException
public DiscordException(java.lang.Exception origin, java.lang.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 java.util.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 java.util.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.
-
-