v0.5.0
alexander-fenster
released this
15 Nov 21:31
·
1004 commits
to main
since this release
Update
$ npm install @google-cloud/bigquery@0.5.0
⚠️ Breaking Changes!
Partial failures are now treated as errors
Previously, when inserting multiple rows of data into a table, if any of them failed to insert, the failed insertion errors were passed in a separate argument to the callback. We've since introduced a custom error type called PartialFailureError
, which is returned as the first err
argument to your callback.
Before
table.insert(data, function(err, insertErrors, apiResponse) {
if (err) {
// An API error occurred.
}
if (insertErrors.length > 0) {
// Some rows failed to insert, while others may have succeeded.
//
// insertErrors[].row (original row object passed to `insert`)
// insertErrors[].errors[].reason
// insertErrors[].errors[].message
}
});
After
table.insert(data, function(err, apiResponse) {
if (err) {
// An API error or partial failure occurred.
if (err.name === 'PartialFailureError') {
// Some rows failed to insert, while others may have succeeded.
// err.errors[].row (original row object passed to `insert`)
// err.errors[].errors[].reason
// err.errors[].errors[].message
}
}
});