forked from DFHack/dfhack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move implementations out of MiscUtils.cpp to Error.cpp and make what() return a more useful description
- Loading branch information
Showing
6 changed files
with
102 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
#include "Error.h" | ||
#include "MiscUtils.h" | ||
|
||
using namespace DFHack::Error; | ||
|
||
inline const char *safe_str(const char *s) | ||
{ | ||
return s ? s : "(NULL)"; | ||
} | ||
|
||
NullPointer::NullPointer(const char *varname) | ||
:All(stl_concat("NULL pointer: ", safe_str(varname))), | ||
varname(varname) | ||
{} | ||
|
||
InvalidArgument::InvalidArgument(const char *expr) | ||
:All(stl_concat("Invalid argument; expected: ", safe_str(expr))), | ||
expr(expr) | ||
{} | ||
|
||
VTableMissing::VTableMissing(const char *name) | ||
:All(stl_concat("Missing vtable address: ", safe_str(name))), | ||
name(name) | ||
{} | ||
|
||
SymbolsXmlParse::SymbolsXmlParse(const char* desc, int id, int row, int col) | ||
:AllSymbols(stl_concat("error ", id, ": ", desc, ", at row ", row, " col ", col)), | ||
desc(safe_str(desc)), id(id), row(row), col(col) | ||
{} | ||
|
||
SymbolsXmlBadAttribute::SymbolsXmlBadAttribute(const char *attr) | ||
:AllSymbols(stl_concat("attribute is either missing or invalid: ", safe_str(attr))), | ||
attr(safe_str(attr)) | ||
{} | ||
|
||
SymbolsXmlNoRoot::SymbolsXmlNoRoot() | ||
:AllSymbols("no root element") | ||
{} | ||
|
||
SymbolsXmlUnderspecifiedEntry::SymbolsXmlUnderspecifiedEntry(const char *where) | ||
:AllSymbols(stl_concat("Underspecified symbol file entry, each entry needs to set both the name attribute and have a value. parent: ", | ||
safe_str(where))), | ||
where(safe_str(where)) | ||
{} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters