0

As per cloudinary JS API, an upload call looks like:

https://www.npmjs.com/package/cloudinary

cloudinary.uploader.upload(fileLocation, function(result) {
   ..something
 });

There is no error returned in the callback. How do I capture the error?

Roee Ben-Ari
  • 600
  • 3
  • 12
runtimeZero
  • 26,466
  • 27
  • 73
  • 126

2 Answers2

1

You can use the v2 version of the SDK, e.g.,:

cloudinary.v2.uploader.upload("sample.jpg", 
    function(error, result) {console.log(result); });

Here's a reference: https://github.com/cloudinary/cloudinary_npm/blob/master/test/uploader_spec.coffee#L233-L236

Itay Taragano
  • 1,901
  • 1
  • 11
  • 12
0
cloudinary.uploader.upload(image, function(result) { 
  if (result.error) {
     //error
  }
}
Cesar Alonso
  • 477
  • 5
  • 11