mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 17:29:55 +00:00
Add more details to exceptions
This commit is contained in:
parent
d852ac20f5
commit
dc8dfe81ce
6 changed files with 15 additions and 6 deletions
|
@ -296,9 +296,8 @@ namespace CSMWorld
|
|||
const int index = getIndex(id);
|
||||
Record<ESXRecordT>& record = *mRecords.at(index);
|
||||
if (record.isDeleted())
|
||||
{
|
||||
throw std::runtime_error("attempt to touch deleted record");
|
||||
}
|
||||
throw std::runtime_error("attempt to touch deleted record from collection of "
|
||||
+ std::string(ESXRecordT::getRecordType()) + ": " + id.toDebugString());
|
||||
|
||||
if (!record.isModified())
|
||||
{
|
||||
|
@ -394,7 +393,8 @@ namespace CSMWorld
|
|||
int index = searchId(id);
|
||||
|
||||
if (index == -1)
|
||||
throw std::runtime_error("invalid ID: " + id.getRefIdString());
|
||||
throw std::runtime_error("ID is not found in collection of " + std::string(ESXRecordT::getRecordType())
|
||||
+ " records: " + id.getRefIdString());
|
||||
|
||||
return index;
|
||||
}
|
||||
|
@ -427,7 +427,8 @@ namespace CSMWorld
|
|||
NestableColumn* Collection<ESXRecordT>::getNestableColumn(int column) const
|
||||
{
|
||||
if (column < 0 || column >= static_cast<int>(mColumns.size()))
|
||||
throw std::runtime_error("column index out of range");
|
||||
throw std::runtime_error(
|
||||
"column index out of range [0, " + std::to_string(mColumns.size()) + "): " + std::to_string(column));
|
||||
|
||||
return mColumns.at(column);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,8 @@ namespace CSMWorld
|
|||
{
|
||||
struct MetaData
|
||||
{
|
||||
static constexpr std::string_view getRecordType() { return "MetaData"; }
|
||||
|
||||
ESM::RefId mId;
|
||||
|
||||
ESM::FormatVersion mFormatVersion;
|
||||
|
|
|
@ -658,7 +658,7 @@ int CSMWorld::RefIdCollection::getIndex(const ESM::RefId& id) const
|
|||
int index = searchId(id);
|
||||
|
||||
if (index == -1)
|
||||
throw std::runtime_error("invalid ID: " + id.toDebugString());
|
||||
throw std::runtime_error("ID is not found in RefId collection: " + id.toDebugString());
|
||||
|
||||
return index;
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ namespace ESM
|
|||
class CellRef
|
||||
{
|
||||
public:
|
||||
static constexpr std::string_view getRecordType() { return "CellRef"; }
|
||||
|
||||
// Reference number
|
||||
// Note: Currently unused for items in containers
|
||||
RefNum mRefNum;
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace ESM
|
|||
{
|
||||
constexpr static RecNameInts sRecordId = REC_DBGP;
|
||||
|
||||
static constexpr std::string_view getRecordType() { return "DebugProfile"; }
|
||||
|
||||
enum Flags
|
||||
{
|
||||
Flag_Default = 1, // add to newly opened scene subviews
|
||||
|
|
|
@ -15,6 +15,8 @@ namespace ESM
|
|||
{
|
||||
constexpr static RecNameInts sRecordId = REC_FILT;
|
||||
|
||||
static constexpr std::string_view getRecordType() { return "Filter"; }
|
||||
|
||||
unsigned int mRecordFlags;
|
||||
RefId mId;
|
||||
|
||||
|
|
Loading…
Reference in a new issue