@@ -72,8 +72,17 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV1Writer(
7272 std::optional<int64_t > snapshot_id, std::string_view manifest_location,
7373 std::shared_ptr<FileIO> file_io, std::shared_ptr<PartitionSpec> partition_spec,
7474 std::shared_ptr<Schema> current_schema) {
75- if (manifest_location.empty () || !file_io || !partition_spec || !current_schema) {
76- return InvalidArgument (" Invalid arguments to create V1 ManifestWriter" );
75+ if (manifest_location.empty ()) {
76+ return InvalidArgument (" Manifest location cannot be empty" );
77+ }
78+ if (!file_io) {
79+ return InvalidArgument (" FileIO cannot be null" );
80+ }
81+ if (!partition_spec) {
82+ return InvalidArgument (" PartitionSpec cannot be null" );
83+ }
84+ if (!current_schema) {
85+ return InvalidArgument (" Current schema cannot be null" );
7786 }
7887
7988 auto adapter = std::make_unique<ManifestEntryAdapterV1>(
@@ -92,8 +101,17 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV2Writer(
92101 std::optional<int64_t > snapshot_id, std::string_view manifest_location,
93102 std::shared_ptr<FileIO> file_io, std::shared_ptr<PartitionSpec> partition_spec,
94103 std::shared_ptr<Schema> current_schema, ManifestContent content) {
95- if (manifest_location.empty () || !file_io || !partition_spec || !current_schema) {
96- return InvalidArgument (" Invalid arguments to create V2 ManifestWriter" );
104+ if (manifest_location.empty ()) {
105+ return InvalidArgument (" Manifest location cannot be empty" );
106+ }
107+ if (!file_io) {
108+ return InvalidArgument (" FileIO cannot be null" );
109+ }
110+ if (!partition_spec) {
111+ return InvalidArgument (" PartitionSpec cannot be null" );
112+ }
113+ if (!current_schema) {
114+ return InvalidArgument (" Current schema cannot be null" );
97115 }
98116 auto adapter = std::make_unique<ManifestEntryAdapterV2>(
99117 snapshot_id, std::move (partition_spec), std::move (current_schema), content);
@@ -114,10 +132,18 @@ Result<std::unique_ptr<ManifestWriter>> ManifestWriter::MakeV3Writer(
114132 ManifestContent content) {
115133 auto adapter = std::make_unique<ManifestEntryAdapterV3>(
116134 snapshot_id, first_row_id, std::move (partition_spec), current_schema, content);
117- if (manifest_location.empty () || !file_io || !partition_spec || !current_schema) {
118- return InvalidArgument (" Invalid arguments to create V3 ManifestWriter" );
135+ if (manifest_location.empty ()) {
136+ return InvalidArgument (" Manifest location cannot be empty" );
137+ }
138+ if (!file_io) {
139+ return InvalidArgument (" FileIO cannot be null" );
140+ }
141+ if (!partition_spec) {
142+ return InvalidArgument (" PartitionSpec cannot be null" );
143+ }
144+ if (!current_schema) {
145+ return InvalidArgument (" Current schema cannot be null" );
119146 }
120-
121147 ICEBERG_RETURN_UNEXPECTED (adapter->Init ());
122148 ICEBERG_RETURN_UNEXPECTED (adapter->StartAppending ());
123149
0 commit comments