Slightly better

This commit is contained in:
Alexey Milovidov 2021-03-28 02:11:46 +03:00
parent cbf5913109
commit bdb69b8f08
2 changed files with 8 additions and 8 deletions

View File

@ -74,13 +74,13 @@ off_t MMapReadBufferFromFileDescriptor::seek(off_t offset, int whence)
else if (whence == SEEK_CUR)
new_pos = count() + offset;
else
throw Exception("MMapReadBufferFromFileDescriptor::seek expects SEEK_SET or SEEK_CUR as whence", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "MMapReadBufferFromFileDescriptor::seek expects SEEK_SET or SEEK_CUR as whence");
working_buffer = internal_buffer;
if (new_pos < 0 || new_pos > off_t(working_buffer.size()))
throw Exception("Cannot seek through file " + getFileName()
+ " because seek position (" + toString(new_pos) + ") is out of bounds [0, " + toString(working_buffer.size()) + "]",
ErrorCodes::CANNOT_SEEK_THROUGH_FILE);
throw Exception(ErrorCodes::CANNOT_SEEK_THROUGH_FILE,
"Cannot seek through file {} because seek position ({}) is out of bounds [0, {}]",
getFileName(), new_pos, working_buffer.size());
position() = working_buffer.begin() + new_pos;
return new_pos;

View File

@ -69,13 +69,13 @@ off_t MMapReadBufferFromFileWithCache::seek(off_t offset, int whence)
else if (whence == SEEK_CUR)
new_pos = count() + offset;
else
throw Exception("MMapReadBufferFromFileWithCache::seek expects SEEK_SET or SEEK_CUR as whence", ErrorCodes::ARGUMENT_OUT_OF_BOUND);
throw Exception(ErrorCodes::ARGUMENT_OUT_OF_BOUND, "MMapReadBufferFromFileWithCache::seek expects SEEK_SET or SEEK_CUR as whence");
working_buffer = internal_buffer;
if (new_pos < 0 || new_pos > off_t(working_buffer.size()))
throw Exception("Cannot seek through file " + getFileName()
+ " because seek position (" + toString(new_pos) + ") is out of bounds [0, " + toString(working_buffer.size()) + "]",
ErrorCodes::CANNOT_SEEK_THROUGH_FILE);
throw Exception(ErrorCodes::CANNOT_SEEK_THROUGH_FILE,
"Cannot seek through file {} because seek position ({}) is out of bounds [0, {}]",
getFileName(), new_pos, working_buffer.size());
position() = working_buffer.begin() + new_pos;
return new_pos;