Skip to content

Commit abb0253

Browse files
committed
fix bad json error
1 parent c953421 commit abb0253

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/nanoarrow/nanoarrow_testing.hpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,7 +714,8 @@ class TestingJSONReader {
714714
ArrowArrayStreamMove(stream.get(), out);
715715
return NANOARROW_OK;
716716
} catch (json::exception& e) {
717-
ArrowErrorSet(error, "Exception in TestingJSONReader::ReadBatch(): %s", e.what());
717+
ArrowErrorSet(error, "Exception in TestingJSONReader::ReadDataFile(): %s",
718+
e.what());
718719
return EINVAL;
719720
}
720721
}

src/nanoarrow/nanoarrow_testing_test.cc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -774,6 +774,9 @@ TEST(NanoarrowTestingTest, NanoarrowTestingTestRoundtripDataFile) {
774774
std::stringstream data_file_json_roundtrip;
775775
ASSERT_EQ(writer.WriteDataFile(data_file_json_roundtrip, stream.get()), NANOARROW_OK);
776776
EXPECT_EQ(data_file_json_roundtrip.str(), data_file_json);
777+
778+
// Also test error for invalid JSON
779+
ASSERT_EQ(reader.ReadDataFile("{", stream.get()), EINVAL);
777780
}
778781

779782
TEST(NanoarrowTestingTest, NanoarrowTestingTestReadBatch) {

0 commit comments

Comments
 (0)