aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
authorYour Name <you@example.com>2021-04-29 14:17:08 -0400
committerYour Name <you@example.com>2021-04-29 14:17:08 -0400
commit5a813a75412ac9b8fadb90c9abd46dd95aee8e9b (patch)
tree75c5466d459c793430a6481cd276a624cd843794 /src/utils.h
parentcd57ad6e208728bafcbc8c7d7b85d88603706978 (diff)
downloaddmtool-5a813a75412ac9b8fadb90c9abd46dd95aee8e9b.tar.gz
dmtool-5a813a75412ac9b8fadb90c9abd46dd95aee8e9b.tar.bz2
dmtool-5a813a75412ac9b8fadb90c9abd46dd95aee8e9b.zip
Removed data files from repo
Diffstat (limited to 'src/utils.h')
-rw-r--r--src/utils.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/utils.h b/src/utils.h
index 156c88b..bdf7ddc 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -22,8 +22,9 @@ namespace utils {
template<typename S, typename D> std::shared_ptr<S> loadDFromJson(const nlohmann::json& data) {
try {
return std::shared_ptr<S>(new D(loadJson(data["type"], data["name"]), data));
- } catch(std::invalid_argument& e) {
- // Fall back on the data passed in
+ } catch(std::exception& e) {
+ // Covers errors in building the creature or fs traversal.
+ // Fall back on the data passed in.
return std::shared_ptr<S>(new D(data, data));
}
}
@@ -57,4 +58,6 @@ namespace utils {
std::vector<std::pair<std::string, int>> copper2coins(int coppers);
std::string getCostString(int coppers);
+
+ std::string toOrdinal(std::size_t number);
}