Resolve error when trying to decode faulty json

This commit is contained in:
Thomas Nordquist
2019-06-06 23:16:05 +02:00
parent e728a721aa
commit bd1f6b6d82

View File

@@ -23,7 +23,11 @@ function nodeDotPathToHistory(history: q.MessageHistory, dotPath: string) {
return history return history
.toArray() .toArray()
.map((message: q.Message) => { .map((message: q.Message) => {
const json = message.value ? JSON.parse(Base64Message.toUnicodeString(message.value)) : {} let json = {}
try {
json = message.value ? JSON.parse(Base64Message.toUnicodeString(message.value)) : {}
} catch (ignore) {}
let value = dotProp.get(json, dotPath) let value = dotProp.get(json, dotPath)
return { x: message.received.getTime(), y: toPlottableValue(value) } return { x: message.received.getTime(), y: toPlottableValue(value) }