@@ -248,12 +248,12 @@ cdef class BuilderManager:
248248 if count > builder.length():
249249 status = builder.append_nulls_raw(count - builder.length())
250250 if not status.ok():
251- raise ValueError (" Failed to append nulls to" , full_key.decode(' utf8' ))
251+ raise ValueError (" Failed to append nulls to" , full_key.decode(' utf8' ), " : " , status.message().decode( ' utf8 ' ) )
252252
253253 # Append the next value.
254254 status = builder.append_raw(doc_iter, value_t)
255255 if not status.ok():
256- raise ValueError (" Could not append raw value to" , full_key.decode(' utf8' ))
256+ raise ValueError (" Could not append raw value to" , full_key.decode(' utf8' ), " : " , status.message().decode( ' utf8 ' ) )
257257
258258 # Recurse into documents.
259259 if value_t == BSON_TYPE_DOCUMENT and builder.type_marker == BSON_TYPE_DOCUMENT:
@@ -326,7 +326,7 @@ cdef class BuilderManager:
326326 if builder.length() < count:
327327 status = builder.append_nulls_raw(count - builder.length())
328328 if not status.ok():
329- raise ValueError (" Failed to append nulls to" , field)
329+ raise ValueError (" Failed to append nulls to" , field, " : " , status.message().decode( " utf8 " ) )
330330
331331 return return_map
332332
@@ -362,7 +362,7 @@ cdef class _ArrayBuilderBase:
362362 value_t = bson_iter_type(& doc_iter)
363363 status = self .append_raw(& doc_iter, value_t)
364364 if not status.ok():
365- raise ValueError (" Could not append raw value of type" , value_t)
365+ raise ValueError (" Could not append raw value of type" , value_t, " : " , status.message().decode( " utf8 " ) )
366366
367367 cdef CStatus append_raw(self , bson_iter_t * doc_iter, bson_type_t value_t):
368368 pass
@@ -376,7 +376,7 @@ cdef class _ArrayBuilderBase:
376376 cpdef append_null(self ):
377377 cdef CStatus status = self .append_null_raw()
378378 if not status.ok():
379- raise ValueError (" Could not append null value" )
379+ raise ValueError (" Could not append null value: " , status.message().decode( " utf8 " ) )
380380
381381 cpdef void append_nulls(self , uint64_t count):
382382 for _ in range (count):
@@ -402,7 +402,7 @@ cdef class _ArrayBuilderBase:
402402 with nogil:
403403 status = builder.get().Finish(& out)
404404 if not status.ok():
405- raise ValueError (" Failed to convert value to array" )
405+ raise ValueError (" Failed to convert value to array: " , status.message().decode( " utf8 " ) )
406406 return pyarrow_wrap_array(out)
407407
408408
0 commit comments