Do not log stack trace when stopping bot

When stopping a LongPollingBot, no exception should be logged due to closing the socket.
This commit is contained in:
ng1905 2017-11-06 07:11:22 +01:00 committed by GitHub
parent 10d0934439
commit 216e910411
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,6 +24,7 @@ import org.telegram.telegrambots.logging.BotLogger;
import java.io.IOException;
import java.io.InvalidObjectException;
import java.net.SocketException;
import java.net.SocketTimeoutException;
import java.nio.charset.StandardCharsets;
import java.security.InvalidParameterException;
@ -259,6 +260,10 @@ public class DefaultBotSession implements BotSession {
BotLogger.severe(responseContent, LOGTAG, e);
}
}
} catch (SocketException e) {
if (!e.getMessage().equals("Socket Closed") {
BotLogger.severe(LOGTAG, e);
}
} catch (SocketTimeoutException e) {
BotLogger.fine(LOGTAG, e);
} catch (InvalidObjectException | TelegramApiRequestException e) {