Skip to content

Commit dcec243

Browse files
committed
Show warning when the results is not an array
1 parent 2ac1574 commit dcec243

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

lib/index.js

+6-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ class BrokerBin {
116116
result: []
117117
}]
118118
}
119-
const results = res.resultset[0].result
119+
const results = res && res.resultset && res.resultset[0] && res.resultset[0].result
120+
if (!Array.isArray(results)) {
121+
console.warn(`Brokerbin result is not an array.`, results)
122+
console.warn(results)
123+
results = []
124+
}
120125
resolve(results)
121126
})
122127
})

0 commit comments

Comments
 (0)