Skip to content

Commit ac3b73a

Browse files
committed
Removed useless encoding exception.
1 parent a9acf77 commit ac3b73a

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

src/main/java/net/javadiscord/javabot/systems/commands/ChangeMyMindCommand.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import net.javadiscord.javabot.command.interfaces.SlashCommand;
1414
import org.json.JSONException;
1515

16-
import java.io.UnsupportedEncodingException;
1716
import java.net.URLEncoder;
1817
import java.nio.charset.StandardCharsets;
1918
import java.time.Instant;
@@ -36,12 +35,7 @@ public class ChangeMyMindCommand implements SlashCommand {
3635
public ReplyCallbackAction handleSlashCommandInteraction(SlashCommandInteractionEvent event) {
3736
var hook = event.getHook();
3837
String encodedSearchTerm;
39-
try {
40-
encodedSearchTerm = URLEncoder.encode(Objects.requireNonNull(event.getOption("text")).getAsString(), StandardCharsets.UTF_8.toString());
41-
} catch (UnsupportedEncodingException e) {
42-
e.printStackTrace();
43-
return event.reply("The text you provided is using an unsupported encoding.");
44-
}
38+
encodedSearchTerm = URLEncoder.encode(Objects.requireNonNull(event.getOption("text")).getAsString(), StandardCharsets.UTF_8);
4539
if (encodedSearchTerm.toCharArray().length > MAX_SEARCH_TERM_LENGTH) {
4640
return event.reply("The text you provided is too long. It may not be more than " + MAX_SEARCH_TERM_LENGTH + " characters.");
4741
}

0 commit comments

Comments
 (0)