Skip to content

Commit a27c550

Browse files
authored
Merge pull request suketa#833 from suketa/fix_error_message_in_appender
fix error messages of DuckDB::Appender methods.
2 parents 5033bb7 + 707dfe2 commit a27c550

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

ext/duckdb/appender.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static VALUE appender_begin_row(VALUE self) {
8787
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
8888

8989
if (duckdb_appender_begin_row(ctx->appender) == DuckDBError) {
90-
rb_raise(eDuckDBError, "failed to flush");
90+
rb_raise(eDuckDBError, "failed to begin row");
9191
}
9292
return self;
9393
}
@@ -97,7 +97,7 @@ static VALUE appender_end_row(VALUE self) {
9797
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
9898

9999
if (duckdb_appender_end_row(ctx->appender) == DuckDBError) {
100-
rb_raise(eDuckDBError, "failed to flush");
100+
rb_raise(eDuckDBError, "failed to end row");
101101
}
102102
return self;
103103
}
@@ -123,7 +123,7 @@ static VALUE appender_append_int8(VALUE self, VALUE val) {
123123
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
124124

125125
if (duckdb_append_int8(ctx->appender, i8val) == DuckDBError) {
126-
rb_raise(eDuckDBError, "failed to append");
126+
rb_raise(eDuckDBError, "failed to append int8");
127127
}
128128
return self;
129129
}
@@ -135,7 +135,7 @@ static VALUE appender_append_int16(VALUE self, VALUE val) {
135135
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
136136

137137
if (duckdb_append_int16(ctx->appender, i16val) == DuckDBError) {
138-
rb_raise(eDuckDBError, "failed to append");
138+
rb_raise(eDuckDBError, "failed to append int16");
139139
}
140140
return self;
141141
}
@@ -147,7 +147,7 @@ static VALUE appender_append_int32(VALUE self, VALUE val) {
147147
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
148148

149149
if (duckdb_append_int32(ctx->appender, i32val) == DuckDBError) {
150-
rb_raise(eDuckDBError, "failed to append");
150+
rb_raise(eDuckDBError, "failed to append int32");
151151
}
152152
return self;
153153
}
@@ -159,7 +159,7 @@ static VALUE appender_append_int64(VALUE self, VALUE val) {
159159
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
160160

161161
if (duckdb_append_int64(ctx->appender, i64val) == DuckDBError) {
162-
rb_raise(eDuckDBError, "failed to append");
162+
rb_raise(eDuckDBError, "failed to append int64");
163163
}
164164
return self;
165165
}
@@ -171,7 +171,7 @@ static VALUE appender_append_uint8(VALUE self, VALUE val) {
171171
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
172172

173173
if (duckdb_append_uint8(ctx->appender, ui8val) == DuckDBError) {
174-
rb_raise(eDuckDBError, "failed to append");
174+
rb_raise(eDuckDBError, "failed to append uint8");
175175
}
176176
return self;
177177
}
@@ -183,7 +183,7 @@ static VALUE appender_append_uint16(VALUE self, VALUE val) {
183183
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
184184

185185
if (duckdb_append_uint16(ctx->appender, ui16val) == DuckDBError) {
186-
rb_raise(eDuckDBError, "failed to append");
186+
rb_raise(eDuckDBError, "failed to append uint16");
187187
}
188188
return self;
189189
}
@@ -195,7 +195,7 @@ static VALUE appender_append_uint32(VALUE self, VALUE val) {
195195
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
196196

197197
if (duckdb_append_uint32(ctx->appender, ui32val) == DuckDBError) {
198-
rb_raise(eDuckDBError, "failed to append");
198+
rb_raise(eDuckDBError, "failed to append uint32");
199199
}
200200
return self;
201201
}
@@ -207,7 +207,7 @@ static VALUE appender_append_uint64(VALUE self, VALUE val) {
207207
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
208208

209209
if (duckdb_append_uint64(ctx->appender, ui64val) == DuckDBError) {
210-
rb_raise(eDuckDBError, "failed to append");
210+
rb_raise(eDuckDBError, "failed to append uint64");
211211
}
212212
return self;
213213
}
@@ -219,7 +219,7 @@ static VALUE appender_append_float(VALUE self, VALUE val) {
219219
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
220220

221221
if (duckdb_append_float(ctx->appender, fval) == DuckDBError) {
222-
rb_raise(eDuckDBError, "failed to append");
222+
rb_raise(eDuckDBError, "failed to append float");
223223
}
224224
return self;
225225
}
@@ -231,7 +231,7 @@ static VALUE appender_append_double(VALUE self, VALUE val) {
231231
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
232232

233233
if (duckdb_append_double(ctx->appender, dval) == DuckDBError) {
234-
rb_raise(eDuckDBError, "failed to append");
234+
rb_raise(eDuckDBError, "failed to append double");
235235
}
236236
return self;
237237
}
@@ -243,7 +243,7 @@ static VALUE appender_append_varchar(VALUE self, VALUE val) {
243243
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
244244

245245
if (duckdb_append_varchar(ctx->appender, pval) == DuckDBError) {
246-
rb_raise(eDuckDBError, "failed to append");
246+
rb_raise(eDuckDBError, "failed to append varchar");
247247
}
248248
return self;
249249
}
@@ -257,7 +257,7 @@ static VALUE appender_append_varchar_length(VALUE self, VALUE val, VALUE len) {
257257
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
258258

259259
if (duckdb_append_varchar_length(ctx->appender, pval, length) == DuckDBError) {
260-
rb_raise(eDuckDBError, "failed to append");
260+
rb_raise(eDuckDBError, "failed to append varchar with length");
261261
}
262262
return self;
263263
}
@@ -271,7 +271,7 @@ static VALUE appender_append_blob(VALUE self, VALUE val) {
271271
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
272272

273273
if (duckdb_append_blob(ctx->appender, (void *)pval, length) == DuckDBError) {
274-
rb_raise(eDuckDBError, "failed to append");
274+
rb_raise(eDuckDBError, "failed to append blob");
275275
}
276276
return self;
277277
}
@@ -281,7 +281,7 @@ static VALUE appender_append_null(VALUE self) {
281281
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
282282

283283
if (duckdb_append_null(ctx->appender) == DuckDBError) {
284-
rb_raise(eDuckDBError, "failed to append");
284+
rb_raise(eDuckDBError, "failed to append null");
285285
}
286286
return self;
287287
}
@@ -292,7 +292,7 @@ static VALUE appender_append_default(VALUE self) {
292292
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
293293

294294
if (duckdb_append_default(ctx->appender) == DuckDBError) {
295-
rb_raise(eDuckDBError, "failed to append");
295+
rb_raise(eDuckDBError, "failed to append default");
296296
}
297297
return self;
298298
}
@@ -403,7 +403,7 @@ static VALUE appender_close(VALUE self) {
403403
TypedData_Get_Struct(self, rubyDuckDBAppender, &appender_data_type, ctx);
404404

405405
if (duckdb_appender_close(ctx->appender) == DuckDBError) {
406-
rb_raise(eDuckDBError, "failed to flush");
406+
rb_raise(eDuckDBError, "failed to close");
407407
}
408408
return self;
409409
}

0 commit comments

Comments
 (0)