mirror of
https://github.com/moparisthebest/davmail
synced 2025-01-12 14:08:38 -05:00
IMAP: Improve HttpException error handling
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@448 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
cf4a925b5a
commit
b16a1b5c92
@ -430,16 +430,23 @@ public class ImapConnection extends AbstractConnection {
|
||||
} catch (SocketException e) {
|
||||
DavGatewayTray.debug("Connection closed");
|
||||
} catch (Exception e) {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
if (e instanceof HttpException) {
|
||||
buffer.append(((HttpException) e).getReasonCode()).append(" ").append(((HttpException) e).getReason());
|
||||
} else {
|
||||
buffer.append(e);
|
||||
}
|
||||
String message = buffer.toString();
|
||||
try {
|
||||
if (commandId != null) {
|
||||
sendClient(commandId + " BAD unable to handle request: " + e.getMessage());
|
||||
sendClient(commandId + " BAD unable to handle request: "+message);
|
||||
} else {
|
||||
sendClient("* BYE unable to handle request: " + e.getMessage());
|
||||
sendClient("* BYE unable to handle request: "+message);
|
||||
}
|
||||
} catch (IOException e2) {
|
||||
DavGatewayTray.warn("Exception sending error to client", e2);
|
||||
}
|
||||
DavGatewayTray.error("Exception handling client", e);
|
||||
DavGatewayTray.error("Exception handling client: "+message, e);
|
||||
} finally {
|
||||
close();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user