X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Fio%2Frecord.cpp;h=4cc5b898bab50e377d71df9b8017cd2932a3dc91;hb=e0713d1539887566e0ea7d85942c305ec727c9dd;hp=eed2e8f37da9e58ffed738767f7e93a89e34263b;hpb=d7f1459ca84043d24143395279de8f3cff86022b;p=cassiopeia.git diff --git a/src/io/record.cpp b/src/io/record.cpp index eed2e8f..4cc5b89 100644 --- a/src/io/record.cpp +++ b/src/io/record.cpp @@ -96,10 +96,10 @@ std::string parseCommand( RecordHeader& head, const std::string& input) { std::stringstream ss; ss << "Expected: " << expectedTotalLength << ", Got: " << input.size(); logger::error( ss.str() ); - throw "Error, invalid length"; + throw std::length_error("Error, invalid length"); } if( checksum != -1 || error || dlen < RECORD_HEADER_SIZE ) { - throw "Error, invalid checksum"; + throw std::runtime_error("Error, invalid checksum"); } data.pop_back(); @@ -112,6 +112,7 @@ std::string parseCommandChunked( RecordHeader& head, std::shared_ptrreadLine() ); + payload = parseCommand( head2, io->readLine() ); + if(!head2.isFollowupOf(head)){ + throw std::runtime_error("Error, header of follow up chunk was malformed"); + } + head = head2; } return all; }