diff options
Diffstat (limited to 'lib/server/makeprotocol.pl.in')
-rwxr-xr-x | lib/server/makeprotocol.pl.in | 27 |
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); |