diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-27 20:23:44 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-27 20:23:44 +1000 |
commit | 332983c97b7a729c4dc5f19aa9ee4a22c420f7d8 (patch) | |
tree | fd9c441b796b522bdd5c7f8fbd32f51b8eff2a28 /source/core/StarJsonPatch.cpp | |
parent | 14b9689b6d4f4ad5276c88130dc6e449bedc0709 (diff) |
The Formatting String Catastrophe
Diffstat (limited to 'source/core/StarJsonPatch.cpp')
-rw-r--r-- | source/core/StarJsonPatch.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/core/StarJsonPatch.cpp b/source/core/StarJsonPatch.cpp index e1ab6de..34c6a82 100644 --- a/source/core/StarJsonPatch.cpp +++ b/source/core/StarJsonPatch.cpp @@ -12,7 +12,7 @@ Json jsonPatch(Json const& base, JsonArray const& patch) { } return res; } catch (JsonException const& e) { - throw JsonPatchException(strf("Could not apply patch to base. %s", e.what())); + throw JsonPatchException(strf("Could not apply patch to base. {}", e.what())); } } @@ -32,9 +32,9 @@ namespace JsonPatching { auto operation = op.getString("op"); return JsonPatching::functionMap.get(operation)(base, op); } catch (JsonException const& e) { - throw JsonPatchException(strf("Could not apply operation to base. %s", e.what())); + throw JsonPatchException(strf("Could not apply operation to base. {}", e.what())); } catch (MapException const&) { - throw JsonPatchException(strf("Invalid operation: %s", op.getString("op"))); + throw JsonPatchException(strf("Invalid operation: {}", op.getString("op"))); } } @@ -49,7 +49,7 @@ namespace JsonPatching { auto testValue = pointer.get(base); if (!value) { if (inverseTest) - throw JsonPatchTestFail(strf("Test operation failure, expected %s to be missing.", op.getString("path"))); + throw JsonPatchTestFail(strf("Test operation failure, expected {} to be missing.", op.getString("path"))); return base; } @@ -57,11 +57,11 @@ namespace JsonPatching { return base; } - throw JsonPatchTestFail(strf("Test operation failure, expected %s found %s.", value, testValue)); + throw JsonPatchTestFail(strf("Test operation failure, expected {} found {}.", value, testValue)); } catch (JsonPath::TraversalException& e) { if (inverseTest) return base; - throw JsonPatchTestFail(strf("Test operation failure: %s", e.what())); + throw JsonPatchTestFail(strf("Test operation failure: {}", e.what())); } } |