diff options
author | Matthias Schiffer <matthias@gamezock.de> | 2008-09-19 11:15:14 +0200 |
---|---|---|
committer | Matthias Schiffer <matthias@gamezock.de> | 2008-09-19 11:15:14 +0200 |
commit | 113b1f4bbdecfab24ed9781b730a76a442adad6f (patch) | |
tree | e28f5c9a7a1afebd7d920f1006aacff401894dbc /src/Net/Packets/ErrorPacket.h | |
parent | 793a0789858734141dfa12d2ab3dd6ea3ed293e8 (diff) | |
download | mad-113b1f4bbdecfab24ed9781b730a76a442adad6f.tar mad-113b1f4bbdecfab24ed9781b730a76a442adad6f.zip |
Exceptions vereinheitlicht
Diffstat (limited to 'src/Net/Packets/ErrorPacket.h')
-rw-r--r-- | src/Net/Packets/ErrorPacket.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/Net/Packets/ErrorPacket.h b/src/Net/Packets/ErrorPacket.h index 4c6a026..01c1303 100644 --- a/src/Net/Packets/ErrorPacket.h +++ b/src/Net/Packets/ErrorPacket.h @@ -33,6 +33,7 @@ class ErrorPacket : public Packet { uint32_t errorCode; uint32_t subCode; uint32_t subSubCode; + uint8_t where[0]; }; ErrorData *errorData; @@ -41,7 +42,9 @@ class ErrorPacket : public Packet { ErrorPacket(Type type, uint16_t requestId, const Common::Exception &exception); ErrorPacket(const Packet &p) : Packet(p) { - setLength(sizeof(ErrorData)); + if(getLength() < sizeof(ErrorData)) + setLength(sizeof(ErrorData)); + errorData = (ErrorData*)&rawData->data; } @@ -56,7 +59,10 @@ class ErrorPacket : public Packet { } Common::Exception getException() const { - return Common::Exception((Common::Exception::ErrorCode)ntohl(errorData->errorCode), ntohl(errorData->subCode), ntohl(errorData->subSubCode)); + return Common::Exception( + std::string((char*)errorData->where, getLength()-sizeof(ErrorData)), (Common::Exception::ErrorCode)ntohl(errorData->errorCode), + ntohl(errorData->subCode), ntohl(errorData->subSubCode) + ); } }; |