[Box Backup-commit] COMMIT r3308 - box/trunk/lib/server
subversion at boxbackup.org
subversion at boxbackup.org
Wed Apr 9 23:14:54 BST 2014
Author: chris
Date: 2014-04-09 23:14:54 +0100 (Wed, 09 Apr 2014)
New Revision: 3308
Modified:
box/trunk/lib/server/makeprotocol.pl.in
Log:
Add a static GetMessage() to BackupProtocolError.
Allows retrieving the error message for a given code, when we no longer have
the protocol object handy.
Conflicts:
lib/server/makeprotocol.pl.in
Modified: box/trunk/lib/server/makeprotocol.pl.in
===================================================================
--- box/trunk/lib/server/makeprotocol.pl.in 2014-04-09 22:14:51 UTC (rev 3307)
+++ box/trunk/lib/server/makeprotocol.pl.in 2014-04-09 22:14:54 UTC (rev 3308)
@@ -323,8 +323,13 @@
if(obj_is_type($cmd,'IsError'))
{
- print H "\tbool IsError(int &rTypeOut, int &rSubTypeOut) const;\n";
- print H "\tstd::string GetMessage() const;\n";
+ $error_message = $cmd;
+ my ($mem_type,$mem_subtype) = split /,/,obj_get_type_params($cmd,'IsError');
+ print H <<__E;
+ bool IsError(int &rTypeOut, int &rSubTypeOut) const;
+ std::string GetMessage() const { return GetMessage(m$mem_subtype); };
+ static std::string GetMessage(int subtype);
+__E
}
my $has_stream = obj_is_type($cmd, 'StreamWithCommand');
@@ -496,9 +501,9 @@
rSubTypeOut = m$mem_subtype;
return true;
}
-std::string $cmd_class\::GetMessage() const
+std::string $cmd_class\::GetMessage(int subtype)
{
- switch(m$mem_subtype)
+ switch(subtype)
{
__E
foreach my $const (@{$cmd_constants{$cmd}})
@@ -513,7 +518,7 @@
print CPP <<__E;
default:
std::ostringstream out;
- out << "Unknown subtype " << m$mem_subtype;
+ out << "Unknown subtype " << subtype;
return out.str();
}
}
@@ -669,6 +674,7 @@
if(rReply.GetType() == expectedType)
{
// Correct response, do nothing
+ SetLastError(Protocol::NoError, Protocol::NoError);
}
else
{
More information about the Boxbackup-commit
mailing list