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

@ -1,6 +1,6 @@
{ {
"name": "node-red-contrib-firebase-admin", "name": "node-red-contrib-firebase-admin",
"version": "1.1.4", "version": "1.1.5",
"description": "A node-red module that wraps the server-side admin SDK of firebase, firestore, et.c.", "description": "A node-red module that wraps the server-side admin SDK of firebase, firestore, et.c.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {

View File

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