Opened 3 years ago
#6021 defect new
IMAP4Client.authenticate returns a Deferred which fails with ConnectionDone instead of a relevant exception
|Reported by:||exarkun||Owned by:|
When the server sends non-base64 data as an authentication challenge, IMAP4Client drops its connection, logs the base64 decoding error, and fires the Deferred returned by authenticate with its connectionLost reason.
It's probably reasonably correct to close the connection, but instead of ConnectionDone, it should fire that Deferred with the base64 decoding exception and it should not log it.
The general principle here is that logging exceptions is a last resort and you only do it if you don't have anywhere else to send them. There is an obvious place to send them in this case: the Deferred returned by authenticate.