From 7bf20d39b67ea9fe5f45301e7ad3f62277b180a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaakko=20Ker=C3=A4nen?= Date: Wed, 26 Feb 2014 17:11:48 +0200 Subject: [PATCH] libdeng2|Cleanup: More information in error messages --- doomsday/libdeng2/src/core/config.cpp | 7 ++++++- doomsday/libdeng2/src/data/block.cpp | 3 ++- doomsday/libdeng2/src/filesys/nativefile.cpp | 3 ++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/doomsday/libdeng2/src/core/config.cpp b/doomsday/libdeng2/src/core/config.cpp index bc1e4f1422..a6e0b20d4e 100644 --- a/doomsday/libdeng2/src/core/config.cpp +++ b/doomsday/libdeng2/src/core/config.cpp @@ -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; } @@ -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()); diff --git a/doomsday/libdeng2/src/data/block.cpp b/doomsday/libdeng2/src/data/block.cpp index 8bfe8145b5..39c667b423 100644 --- a/doomsday/libdeng2/src/data/block.cpp +++ b/doomsday/libdeng2/src/data/block.cpp @@ -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) diff --git a/doomsday/libdeng2/src/filesys/nativefile.cpp b/doomsday/libdeng2/src/filesys/nativefile.cpp index de5baa25a6..7567cbdadd 100644 --- a/doomsday/libdeng2/src/filesys/nativefile.cpp +++ b/doomsday/libdeng2/src/filesys/nativefile.cpp @@ -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(values), count);