IMAP: Fixed stream vs. parse exception handling.

* Protocol::HandleNextResponse() will now exit when a stream exception
  occurs.
* This should fix bug #12601.
This commit is contained in:
Axel Dörfler
2016-02-10 13:55:56 +01:00
parent 15216b261a
commit f429e4f442
3 changed files with 12 additions and 5 deletions
@@ -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)
@@ -1,5 +1,5 @@
/*
* Copyright 2011-2013, Axel Dörfler, [email protected].
* Copyright 2011-2016, Axel Dörfler, [email protected].
* 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)
{
}
@@ -1,5 +1,5 @@
/*
* Copyright 2011-2013, Axel Dörfler, [email protected].
* Copyright 2011-2016, Axel Dörfler, [email protected].
* 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;
};