Skip to content

Commit

Permalink
libdeng2|Cleanup: More information in error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Feb 26, 2014
1 parent f63db80 commit 7bf20d3
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 6 additions & 1 deletion doomsday/libdeng2/src/core/config.cpp
Expand Up @@ -112,7 +112,7 @@ void Config::read()
// If script is newer, it should be rerun.
if(scriptFile.status().modifiedAt > d->refuge.lastWrittenAt())
{
LOG_MSG("%s is newer than %s, rerunning the script.")
LOG_MSG("%s is newer than %s, rerunning the script")
<< d->configPath << d->refuge.path();
shouldRunScript = true;
}
Expand All @@ -122,6 +122,11 @@ void Config::read()
// It is missing from persist.pack if the config hasn't been written yet.
shouldRunScript = true;
}
catch(IByteArray::OffsetError const &)
{
// Empty or missing serialization?
shouldRunScript = true;
}
catch(Error const &error)
{
LOG_WARNING(error.what());
Expand Down
3 changes: 2 additions & 1 deletion doomsday/libdeng2/src/data/block.cpp
Expand Up @@ -75,7 +75,8 @@ void Block::get(Offset atPos, Byte *values, Size count) const
if(atPos + count > size())
{
/// @throw OffsetError The accessed region of the block was out of range.
throw OffsetError("Block::get", "Out of range");
throw OffsetError("Block::get", "Out of range " +
String("(%1[+%2] > %3)").arg(atPos).arg(count).arg(size()));
}

for(Offset i = atPos; count > 0; ++i, --count)
Expand Down
3 changes: 2 additions & 1 deletion doomsday/libdeng2/src/filesys/nativefile.cpp
Expand Up @@ -98,7 +98,8 @@ void NativeFile::get(Offset at, Byte *values, Size count) const
{
/// @throw IByteArray::OffsetError The region specified for reading extends
/// beyond the bounds of the file.
throw OffsetError("NativeFile::get", "Cannot read past end of file");
throw OffsetError("NativeFile::get", description() + ": cannot read past end of file " +
String("(%1[+%2] > %3)").arg(at).arg(count).arg(size()));
}
in.seek(at);
in.read(reinterpret_cast<char *>(values), count);
Expand Down

0 comments on commit 7bf20d3

Please sign in to comment.