aboutsummaryrefslogtreecommitdiff
path: root/src/server/shared
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/shared')
-rw-r--r--src/server/shared/Packets/ByteBuffer.cpp10
-rw-r--r--src/server/shared/Packets/ByteBuffer.h2
2 files changed, 6 insertions, 6 deletions
diff --git a/src/server/shared/Packets/ByteBuffer.cpp b/src/server/shared/Packets/ByteBuffer.cpp
index 30557a05af1..0406da061e7 100644
--- a/src/server/shared/Packets/ByteBuffer.cpp
+++ b/src/server/shared/Packets/ByteBuffer.cpp
@@ -53,16 +53,16 @@ ByteBufferSourceException::ByteBufferSourceException(size_t pos, size_t size,
message().assign(ss.str());
}
-ByteBufferInvalidValueException::ByteBufferInvalidValueException(char const* type, size_t pos)
+ByteBufferInvalidValueException::ByteBufferInvalidValueException(char const* type, char const* value)
{
- message().assign(Trinity::StringFormat("Invalid %s value found in ByteBuffer at pos " SZFMTD, type, pos));
+ message().assign(Trinity::StringFormat("Invalid %s value (%s) found in ByteBuffer", type, value));
}
ByteBuffer& ByteBuffer::operator>>(float& value)
{
value = read<float>();
if (!std::isfinite(value))
- throw ByteBufferInvalidValueException("float", _rpos - sizeof(float));
+ throw ByteBufferInvalidValueException("float", "infinity");
return *this;
}
@@ -70,7 +70,7 @@ ByteBuffer& ByteBuffer::operator>>(double& value)
{
value = read<double>();
if (!std::isfinite(value))
- throw ByteBufferInvalidValueException("double", _rpos - sizeof(double));
+ throw ByteBufferInvalidValueException("double", "infinity");
return *this;
}
@@ -85,7 +85,7 @@ std::string ByteBuffer::ReadCString(bool requireValidUtf8 /*= true*/)
value += c;
}
if (requireValidUtf8 && !utf8::is_valid(value.begin(), value.end()))
- throw ByteBufferInvalidValueException("string", _rpos - value.length() - 1);
+ throw ByteBufferInvalidValueException("string", value.c_str());
return value;
}
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h
index 843e303de0c..549786f3aee 100644
--- a/src/server/shared/Packets/ByteBuffer.h
+++ b/src/server/shared/Packets/ByteBuffer.h
@@ -60,7 +60,7 @@ public:
class TC_SHARED_API ByteBufferInvalidValueException : public ByteBufferException
{
public:
- ByteBufferInvalidValueException(char const* type, size_t pos);
+ ByteBufferInvalidValueException(char const* type, char const* value);
~ByteBufferInvalidValueException() noexcept = default;
};