Package net.dv8tion.jda.api.exceptions
Class ErrorResponseException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
net.dv8tion.jda.api.exceptions.ErrorResponseException
- All Implemented Interfaces:
- Serializable
Indicates an unhandled error that is returned by Discord API Request using 
It holds an
RestAction
 It holds an
ErrorResponse- See Also:
- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic classAn error for aErrorResponseException.SchemaError.static classSchema error which supplies more context to a ErrorResponse.
- 
Method SummaryModifier and TypeMethodDescriptionstatic ErrorResponseExceptioncreate(String message, ErrorResponseException cause) static ErrorResponseExceptioncreate(ErrorResponse errorResponse, Response response) intThe discord error code for this error response.TheErrorResponsecorresponding for the received error response from DiscordThe meaning for this error.The Discord Response causing the ErrorResponseTheSchemaErrorsfor this error response.ignore(Collection<ErrorResponse> set) Ignore the specified set of error responses.ignore(Consumer<? super Throwable> orElse, Collection<ErrorResponse> set) Ignore the specified set of error responses.ignore(Consumer<? super Throwable> orElse, ErrorResponse ignored, ErrorResponse... errorResponses) Ignore the specified set of error responses.ignore(ErrorResponse ignored, ErrorResponse... errorResponses) Ignore the specified set of error responses.booleanWhether this is an internal server error from discord (status 500)Methods inherited from class java.lang.ThrowableaddSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
- 
Method Details- 
isServerErrorpublic boolean isServerError()Whether this is an internal server error from discord (status 500)- Returns:
- True, if this is an internal server error
         ErrorResponse.SERVER_ERROR
 
- 
getMeaningThe meaning for this error.
 It is possible that the value from this method is different forserver errors- Returns:
- Never-null meaning of this error.
 
- 
getErrorCodepublic int getErrorCode()The discord error code for this error response.- Returns:
- The discord error code.
- See Also:
 
- 
getErrorResponseTheErrorResponsecorresponding for the received error response from Discord- Returns:
- ErrorResponse
 
- 
getResponseThe Discord Response causing the ErrorResponse- Returns:
- Response
 
- 
getSchemaErrorsTheSchemaErrorsfor this error response.
 These errors provide more context of what part in the body caused the error, and more explanation for the error itself.- Returns:
- Possibly-empty list of SchemaError
 
- 
create@Nonnull public static ErrorResponseException create(@Nonnull String message, @Nonnull ErrorResponseException cause) 
- 
create@Nonnull public static ErrorResponseException create(@Nonnull ErrorResponse errorResponse, @Nonnull Response response) 
- 
ignoreIgnore the specified set of error responses.Example 
 // Creates a message with the provided content and deletes it 30 seconds later public static void selfDestruct(MessageChannel channel, String content) { channel.sendMessage(content).queue((message) -> message.delete().queueAfter(30, SECONDS, null, ignore(EnumSet.of(UNKNOWN_MESSAGE))) ); }- Parameters:
- set- Set of ignored error responses
- Returns:
- Consumerdecorator for- RestAction.getDefaultFailure()which ignores the specified- ErrorResponses
- Throws:
- IllegalArgumentException- If provided with null or an empty collection
 
- 
ignore@Nonnull public static Consumer<Throwable> ignore(@Nonnull ErrorResponse ignored, @Nonnull ErrorResponse... errorResponses) Ignore the specified set of error responses.Example 
 // Creates a message with the provided content and deletes it 30 seconds later public static void selfDestruct(MessageChannel channel, String content) { channel.sendMessage(content).queue((message) -> message.delete().queueAfter(30, SECONDS, null, ignore(UNKNOWN_MESSAGE)) ); }- Parameters:
- ignored- Ignored error response
- errorResponses- Additional error responses to ignore
- Returns:
- Consumerdecorator for- RestAction.getDefaultFailure()which ignores the specified- ErrorResponses
- Throws:
- IllegalArgumentException- If provided with null
 
- 
ignore@Nonnull public static Consumer<Throwable> ignore(@Nonnull Consumer<? super Throwable> orElse, @Nonnull ErrorResponse ignored, @Nonnull ErrorResponse... errorResponses) Ignore the specified set of error responses.Example 
 // Creates a message with the provided content and deletes it 30 seconds later public static void selfDestruct(MessageChannel channel, String content) { channel.sendMessage(content).queue((message) -> message.delete().queueAfter(30, SECONDS, null, ignore(Throwable::printStackTrace, UNKNOWN_MESSAGE)) ); }- Parameters:
- orElse- Behavior to default to if the error response is not ignored
- ignored- Ignored error response
- errorResponses- Additional error responses to ignore
- Returns:
- Consumerdecorator for the provided callback which ignores the specified- ErrorResponses
- Throws:
- IllegalArgumentException- If provided with null
 
- 
ignore@Nonnull public static Consumer<Throwable> ignore(@Nonnull Consumer<? super Throwable> orElse, @Nonnull Collection<ErrorResponse> set) Ignore the specified set of error responses.Example 
 // Creates a message with the provided content and deletes it 30 seconds later public static void selfDestruct(MessageChannel channel, String content) { channel.sendMessage(content).queue((message) -> message.delete().queueAfter(30, SECONDS, null, ignore(Throwable::printStackTrace, EnumSet.of(UNKNOWN_MESSAGE))) ); }- Parameters:
- orElse- Behavior to default to if the error response is not ignored
- set- Set of ignored error responses
- Returns:
- Consumerdecorator for the provided callback which ignores the specified- ErrorResponses
- Throws:
- IllegalArgumentException- If provided with null or an empty collection
 
 
-