Skip to content

Commit

Permalink
add format_as to ParseError
Browse files Browse the repository at this point in the history
  • Loading branch information
matcool committed Nov 10, 2024
1 parent 6a5da5d commit b91f31d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.21)

project(mat-json VERSION 3.0.0)
project(mat-json VERSION 3.0.1)

set(SOURCE_FILES
src/external/dragonbox.cpp
Expand Down
4 changes: 4 additions & 0 deletions include/matjson.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,10 @@ namespace matjson {
inline std::string format_as(matjson::Value const& value) {
return value.dump(matjson::NO_INDENTATION);
}

inline std::string format_as(matjson::ParseError const& value) {
return std::string(value);
}
}

// allow destructuring
Expand Down
1 change: 1 addition & 0 deletions test/manual.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ Result<void> fancyMain(int argc, char const* argv[]) {
fmt::println("it failed: {}", result.unwrapErr());
}
}
fmt::println("foo {}", matjson::parse("[").unwrapErr());
return Ok();
}

Expand Down

0 comments on commit b91f31d

Please sign in to comment.