summaryrefslogtreecommitdiff
path: root/lib/server
diff options
context:
space:
mode:
authorChris Wilson <chris+github@qwirx.com>2014-09-04 01:36:39 +0000
committerChris Wilson <chris+github@qwirx.com>2014-09-04 01:36:39 +0000
commit319cc882abaf7cdc0c40d441bb771eb574e16083 (patch)
treeb405f676dc1dfb04ea39fa152fe10cfd9f90bc58 /lib/server
parent6a5db53baca75713c35a124755a3b90025bba653 (diff)
Catch exceptions while executing store commands, and return an error message.
This will allow the client to eventually have more information about what went wrong on the server, if the server admin agrees, and makes test debugging easier. Backport some additional testbackupstore tests from the test refactor branch. Merged back changes from the test refactor branch to reduce diffs.
Diffstat (limited to 'lib/server')
-rwxr-xr-xlib/server/makeprotocol.pl.in27
1 files changed, 20 insertions, 7 deletions
diff --git a/lib/server/makeprotocol.pl.in b/lib/server/makeprotocol.pl.in
index 348c85d3..7d318258 100755
--- a/lib/server/makeprotocol.pl.in
+++ b/lib/server/makeprotocol.pl.in
@@ -1068,17 +1068,30 @@ void $server_or_client_class\::DoServer($context_class &rContext)
std::auto_ptr<$message_base_class> preply;
// Run the command
- if(pobj->HasStreamWithCommand())
+ try
{
- std::auto_ptr<IOStream> apDataStream = ReceiveStream();
- SelfFlushingStream autoflush(*apDataStream);
- preply = pobj->DoCommand(*this, rContext, *apDataStream);
+ if(pobj->HasStreamWithCommand())
+ {
+ std::auto_ptr<IOStream> apDataStream = ReceiveStream();
+ SelfFlushingStream autoflush(*apDataStream);
+ preply = pobj->DoCommand(*this, rContext, *apDataStream);
+ }
+ else
+ {
+ preply = pobj->DoCommand(*this, rContext);
+ }
}
- else
+ catch (std::exception &e)
{
- preply = pobj->DoCommand(*this, rContext);
+ Send($cmd_classes{$error_message}());
+ throw;
}
-
+ catch (...)
+ {
+ Send($cmd_classes{$error_message}());
+ throw;
+ }
+
// Send the reply
Send(*preply);