aboutsummaryrefslogtreecommitdiff
path: root/src/utils.h
diff options
context:
space:
mode:
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);
}