2018-02-05 17:18:35 -07:00
|
|
|
#include "Error.h"
|
|
|
|
#include "MiscUtils.h"
|
|
|
|
|
|
|
|
using namespace DFHack::Error;
|
|
|
|
|
2018-02-07 09:40:52 -07:00
|
|
|
inline std::string safe_str(const char *s)
|
2018-02-05 17:18:35 -07:00
|
|
|
{
|
|
|
|
return s ? s : "(NULL)";
|
|
|
|
}
|
|
|
|
|
|
|
|
NullPointer::NullPointer(const char *varname)
|
2018-02-07 09:40:52 -07:00
|
|
|
:All("NULL pointer: " + safe_str(varname)),
|
2018-02-05 17:18:35 -07:00
|
|
|
varname(varname)
|
|
|
|
{}
|
|
|
|
|
|
|
|
InvalidArgument::InvalidArgument(const char *expr)
|
2018-02-07 09:40:52 -07:00
|
|
|
:All("Invalid argument; expected: " + safe_str(expr)),
|
2018-02-05 17:18:35 -07:00
|
|
|
expr(expr)
|
|
|
|
{}
|
|
|
|
|
|
|
|
VTableMissing::VTableMissing(const char *name)
|
2018-02-07 09:40:52 -07:00
|
|
|
:All("Missing vtable address: " + safe_str(name)),
|
2018-02-05 17:18:35 -07:00
|
|
|
name(name)
|
|
|
|
{}
|
|
|
|
|
|
|
|
SymbolsXmlParse::SymbolsXmlParse(const char* desc, int id, int row, int col)
|
2018-02-07 09:40:52 -07:00
|
|
|
:AllSymbols(stl_sprintf("error %d: %s, at row %d col %d", id, desc, row, col)),
|
2018-02-05 17:18:35 -07:00
|
|
|
desc(safe_str(desc)), id(id), row(row), col(col)
|
|
|
|
{}
|
|
|
|
|
|
|
|
SymbolsXmlBadAttribute::SymbolsXmlBadAttribute(const char *attr)
|
2018-02-07 09:40:52 -07:00
|
|
|
:AllSymbols("attribute is either missing or invalid: " + safe_str(attr)),
|
2018-02-05 17:18:35 -07:00
|
|
|
attr(safe_str(attr))
|
|
|
|
{}
|
|
|
|
|
|
|
|
SymbolsXmlNoRoot::SymbolsXmlNoRoot()
|
|
|
|
:AllSymbols("no root element")
|
|
|
|
{}
|
|
|
|
|
|
|
|
SymbolsXmlUnderspecifiedEntry::SymbolsXmlUnderspecifiedEntry(const char *where)
|
2018-02-07 09:40:52 -07:00
|
|
|
:AllSymbols("Underspecified symbol file entry, each entry needs to set both the name attribute and have a value. parent: " + safe_str(where)),
|
2018-02-05 17:18:35 -07:00
|
|
|
where(safe_str(where))
|
|
|
|
{}
|