cloudinary_npm
cloudinary_npm copied to clipboard
Reject promise for error codes 400, 401, 404, 420 and 500 during file upload
Inside handle_repsone method (file: lib/uploader.coffee), for HTTP error codes 400,401,404,420 and 500, promise is being resolved deferred.resolve(result) (line number: 178) with result object holding the error object. Instead, shouldn't the promise be rejected with preferably error object deferred.reject(result["error"]) or result object deferred.reject(result)?
Its to be expected but just want to highlight that anyone else who was used to handling errors like:
cloudinary.uploader.upload(
...,
function (result) {
if (result.error) { // TODO: source code needs to change from the old-style of handling the resolved error
promise.reject(result);
} else {
console.log('uploadProductImage() - resolved cloudinary.uploader.upload()');
promise.resolve(result);
}
},
...
should update their own source code, when upgrading to v1.0.13