stream upload catching errors (NODE.JS)
could you please advise which option is correct for error handling?
const writeStream = cloudinary.v2.uploader.upload_stream(result => {
if(result.error) throw new Error()
// Use result
});
or
const writeStream = cloudinary.v2.uploader.upload_stream((error, result) => {
if(error) throw new Error()
// Use result
});
-
Hi,
The second implementation is preferred. You can see the sample project for an example- https://github.com/cloudinary/cloudinary_npm/blob/bf7103aac2714002305566d05a53ded4cdcafbca/samples/basic/basic.js
Post is closed for comments.
Comments
1 comment