Added try catch for getStream
This commit is contained in:
parent
63ab17ce4c
commit
3a88d983fc
1 changed files with 20 additions and 15 deletions
5
libs.js
5
libs.js
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue