Changeset 2172
- Timestamp:
- 28/05/2008 13:33:42 (4 years ago)
- File:
-
- 1 edited
-
box/trunk/lib/server/makeprotocol.pl.in (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
box/trunk/lib/server/makeprotocol.pl.in
r2084 r2172 179 179 180 180 #include "Box.h" 181 182 #include <sstream> 183 181 184 #include "$h_filename" 182 185 #include "IOStream.h" … … 274 277 if($derive_objects_from ne 'ProtocolObject') 275 278 { 276 # output a definition for the protocol object der viced class279 # output a definition for the protocol object derived class 277 280 print H <<__E; 278 281 class ${protocol_name}ProtocolServer; … … 339 342 { 340 343 print H "\tbool IsError(int &rTypeOut, int &rSubTypeOut) const;\n"; 344 print H "\tstd::string GetMessage() const;\n"; 341 345 } 342 346 if($type eq 'Server' && obj_is_type($cmd, 'Command')) … … 498 502 rSubTypeOut = m$mem_subtype; 499 503 return true; 504 } 505 std::string ${class}GetMessage() const 506 { 507 switch(m$mem_subtype) 508 { 509 __E 510 foreach my $const (@{$cmd_constants{$cmd}}) 511 { 512 next unless $const =~ /^Err_(.*)/; 513 my $shortname = $1; 514 $const =~ s/ = .*//; 515 print CPP <<__E; 516 case $const: return "$shortname"; 517 __E 518 } 519 print CPP <<__E; 520 default: 521 std::ostringstream out; 522 out << "Unknown subtype " << m$mem_subtype; 523 return out.str(); 524 } 500 525 } 501 526 __E … … 891 916 { 892 917 SetError(type, subType); 893 BOX_WARNING(" Protocol: Received error " << type<<894 "/" << subType);918 BOX_WARNING("$cmd command failed: received error " << 919 ((${classname_base}Error&)*preply).GetMessage()); 895 920 } 896 921 else 897 922 { 898 923 SetError(Protocol::UnknownError, Protocol::UnknownError); 899 BOX_WARNING("Protocol: Received unknown error"); 924 BOX_WARNING("$cmd command failed: received " 925 "unexpected response type " << 926 preply->GetType()); 900 927 } 901 928
Note: See TracChangeset
for help on using the changeset viewer.
