additional exception checking in storage-read

This commit is contained in:
Peter Svensson
2019-07-15 11:34:57 +02:00
parent f8fc2a32d7
commit ca92bc0617
2 changed files with 19 additions and 13 deletions

View File

@ -45,19 +45,25 @@ module.exports = function(RED) {
})(_file)
})
} else {
console.log('reading single file from path '+path)
this.storage
.bucket(bucket)
.file(path).download().then((file)=>{
console.log('storage-read got file')
//console.dir(file)
msg.payload = file
console.log('* reading single file from path '+path)
try{
this.storage
.bucket(bucket)
.file(path).download().then((file)=>{
console.log('storage-read got file')
//console.dir(file)
msg.payload = file
node.send(msg)
}, (fail)=>{
console.log('storage-read could not find single file '+path)
msg.payload = undefined
node.send(msg)
})
} catch(ex){
console.log('storage-read caught exception: '+ex)
node.send(msg)
}, (fail)=>{
console.log('storage-read could not find single file '+path)
msg.payload = undefined
node.send(msg)
})
}
}
}
}.bind(this));