Added try catch for getStream

This commit is contained in:
dbroqua 2020-01-11 21:56:55 +01:00
parent 63ab17ce4c
commit 3a88d983fc

View file

@ -173,6 +173,7 @@ const getStream = (callback) => {
(error, response, body) => { (error, response, body) => {
if (!error && response.statusCode === 200) { if (!error && response.statusCode === 200) {
let res = null let res = null
try {
const _body = JSON.parse(body) const _body = JSON.parse(body)
res = { res = {
@ -191,6 +192,10 @@ const getStream = (callback) => {
} else { } else {
error = true error = true
} }
} catch (e) {
error = e
console.error('getStream error:', error)
}
} }
if (error) { if (error) {