diff options
author | Chris Wilson <chris+github@qwirx.com> | 2014-10-31 22:09:42 +0000 |
---|---|---|
committer | Chris Wilson <chris+github@qwirx.com> | 2014-10-31 22:09:42 +0000 |
commit | e8efeb785c158581be729aa1dee122f50789ac86 (patch) | |
tree | dd1fda26285a9255411c607b6910b79a89877242 /test | |
parent | 9236e14007c068d7d9294d90aeb976eb9cecab84 (diff) |
Refactor handling of exceptions in protocol server command executors.
Add a standard method to Replyable that will be called if a recoverable
exception (a BoxException) occurs, and can return a protocol Message to be
sent to the client, such as an error code for various standard errors, or
rethrow the exception.
If you want something different, catch exceptions and return the desired
reply yourself, or you'll get the default handling.
Diffstat (limited to 'test')
-rw-r--r-- | test/basicserver/TestCommands.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/basicserver/TestCommands.cpp b/test/basicserver/TestCommands.cpp index 63425f48..bdbdffeb 100644 --- a/test/basicserver/TestCommands.cpp +++ b/test/basicserver/TestCommands.cpp @@ -11,6 +11,11 @@ #include "MemLeakFindOn.h" +std::auto_ptr<TestProtocolMessage> TestProtocolReplyable::HandleException(BoxException& e) const +{ + throw; +} + std::auto_ptr<TestProtocolMessage> TestProtocolHello::DoCommand(TestProtocolReplyable &rProtocol, TestContext &rContext) const { if(mNumber32 != 41 || mNumber16 != 87 || mNumber8 != 11 || mText != "pingu") |