diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Protocol.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Protocol.cpp index 73517c5707..61c98c0719 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Protocol.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Protocol.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2010-2015, Haiku Inc. All Rights Reserved. + * Copyright 2010-2016, Haiku Inc. All Rights Reserved. * Copyright 2010 Clemens Zeidler. All rights reserved. * * Distributed under the terms of the MIT License. @@ -355,6 +355,8 @@ Protocol::HandleResponse(Command* command, bigtime_t timeout, } } catch (ParseException& exception) { printf("Error during parsing: %s\n", exception.Message()); + } catch (StreamException& exception) { + return exception.Status(); } if (fOngoingCommands.size() == 0) diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.cpp b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.cpp index 76182b8132..81abd61fb6 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.cpp +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2011-2016, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -393,7 +393,7 @@ ParseException::ParseException(const char* format, ...) StreamException::StreamException(status_t status) : - ParseException("Error from stream: %s", status) + fStatus(status) { } diff --git a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.h b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.h index b37bc9826b..143817100d 100644 --- a/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.h +++ b/src/add-ons/mail_daemon/inbound_protocols/imap/imap_lib/Response.h @@ -1,5 +1,5 @@ /* - * Copyright 2011-2013, Axel Dörfler, axeld@pinc-software.de. + * Copyright 2011-2016, Axel Dörfler, axeld@pinc-software.de. * Distributed under the terms of the MIT License. */ #ifndef RESPONSE_H @@ -107,9 +107,14 @@ protected: }; -class StreamException : public ParseException { +class StreamException : public std::exception { public: StreamException(status_t status); + + status_t Status() const { return fStatus; } + +private: + status_t fStatus; };