根据cloudinary js api,上传调用如下:
https://www.npmjs.com/package/cloudinary
cloudinary.uploader.upload(fileLocation, function(result) {
..something
});
回调中没有返回错误。如何捕获错误?
答案 0 :(得分:1)
您可以使用SDK的v2
版本,例如:
cloudinary.v2.uploader.upload("sample.jpg",
function(error, result) {console.log(result); });
这里有一个参考: https://github.com/cloudinary/cloudinary_npm/blob/master/test/uploader_spec.coffee#L233-L236
答案 1 :(得分:0)
cloudinary.uploader.upload(image, function(result) {
if (result.error) {
//error
}
}