@@ -133,10 +133,9 @@ Status StructType::InitFieldByLowerCaseName() const {
133133}
134134
135135ListType::ListType (SchemaField element) : element_(std::move(element)) {
136- if (element_.name () != kElementName ) {
137- throw IcebergError (std::format (" ListType: child field name should be '{}', was '{}'" ,
138- kElementName , element_.name ()));
139- }
136+ ICEBERG_CHECK (element_.name () == kElementName ,
137+ " ListType: child field name should be '{}', was '{}'" , kElementName ,
138+ element_.name ());
140139}
141140
142141ListType::ListType (int32_t field_id, std::shared_ptr<Type> type, bool optional)
@@ -189,14 +188,12 @@ bool ListType::Equals(const Type& other) const {
189188
190189MapType::MapType (SchemaField key, SchemaField value)
191190 : fields_{std::move (key), std::move (value)} {
192- if (this ->key ().name () != kKeyName ) {
193- throw IcebergError (std::format (" MapType: key field name should be '{}', was '{}'" ,
194- kKeyName , this ->key ().name ()));
195- }
196- if (this ->value ().name () != kValueName ) {
197- throw IcebergError (std::format (" MapType: value field name should be '{}', was '{}'" ,
198- kValueName , this ->value ().name ()));
199- }
191+ ICEBERG_CHECK (this ->key ().name () == kKeyName ,
192+ " MapType: key field name should be '{}', was '{}'" , kKeyName ,
193+ this ->key ().name ());
194+ ICEBERG_CHECK (this ->value ().name () == kValueName ,
195+ " MapType: value field name should be '{}', was '{}'" , kValueName ,
196+ this ->value ().name ());
200197}
201198
202199const SchemaField& MapType::key () const { return fields_[0 ]; }
@@ -278,10 +275,8 @@ bool DoubleType::Equals(const Type& other) const { return other.type_id() == kTy
278275
279276DecimalType::DecimalType (int32_t precision, int32_t scale)
280277 : precision_(precision), scale_(scale) {
281- if (precision < 0 || precision > kMaxPrecision ) {
282- throw IcebergError (
283- std::format (" DecimalType: precision must be in [0, 38], was {}" , precision));
284- }
278+ ICEBERG_CHECK (precision >= 0 && precision <= kMaxPrecision ,
279+ " DecimalType: precision must be in [0, 38], was {}" , precision);
285280}
286281
287282int32_t DecimalType::precision () const { return precision_; }
@@ -329,9 +324,7 @@ std::string UuidType::ToString() const { return "uuid"; }
329324bool UuidType::Equals (const Type& other) const { return other.type_id () == kTypeId ; }
330325
331326FixedType::FixedType (int32_t length) : length_(length) {
332- if (length < 0 ) {
333- throw IcebergError (std::format (" FixedType: length must be >= 0, was {}" , length));
334- }
327+ ICEBERG_CHECK (length >= 0 , " FixedType: length must be >= 0, was {}" , length);
335328}
336329
337330int32_t FixedType::length () const { return length_; }
0 commit comments