This repository has been archived by the owner on Jul 20, 2023. It is now read-only.
@google-cloud/vision v0.6.0
⚠️ Breaking Changes!
Partial failures are now treated as errors
Previously, if any annotations were not successful, the errors were combined with any successful annotations. We've since introduced a custom error type called PartialFailureError
, which is returned as the first err
argument to your callback.
Before
vision.detect(image, ['faces'], function(err, detections, apiResponse) {
if (err) {
// An API error occurred.
}
if (detections.faces.errors.length > 0) {
// Errors occurred while trying to use this image for a face annotation.
}
});
After
vision.detect(image, ['faces'], function(err, detections, apiResponse) {
if (err) {
// An API error or partial failure occurred.
if (err.name === 'PartialFailureError') {
// Errors occurred while trying to use this image for a face annotation.
// err.errors[].image (original image passed to `detect`)
// err.errors[].errors[].code
// err.errors[].errors[].message
// err.errors[].errors[].type
}
}
// `detections` will contain all of the results that could be annotated.
});