Debug metadata parsing

This commit is contained in:
lowlighter
2021-08-12 15:34:26 +02:00
parent 87ac406f0a
commit 29d4397d76

View File

@@ -142,17 +142,19 @@ metadata.plugin = async function({__plugins, name, logger}) {
}
//JSON
case "json": {
console.log("DEBUG: ", value)
if (typeof value === "object")
return value
console.log("DEBUG1: ", value)
try {
value = JSON.parse(value)
}
catch (error) {
console.log("DEBUG: ", error)
console.log("DEBUG2: ", error)
try {
value = JSON.parse(decodeURIComponent(value))
}
catch (error) {
console.log("DEBUG: ", error)
console.log("DEBUG3: ", error)
logger(`metrics/inputs > failed to parse json : ${value}`)
value = JSON.parse(defaulted)
}