Reduce loglevel on node def validation (#295)

* Lower the loglevel of node def validation messages

* Fix tests
This commit is contained in:
Chenlei Hu
2024-08-04 10:08:55 -04:00
committed by GitHub
parent 4bebcb408e
commit 0384cf96c4
3 changed files with 37 additions and 26 deletions

View File

@@ -249,11 +249,17 @@ class ComfyApi extends EventTarget {
const objectInfoUnsafe = await resp.json()
const objectInfo: Record<string, ComfyNodeDef> = {}
for (const key in objectInfoUnsafe) {
try {
objectInfo[key] = validateComfyNodeDef(objectInfoUnsafe[key])
} catch (e) {
console.warn('Ignore node definition: ', key)
console.error(e)
const validatedDef = await validateComfyNodeDef(
objectInfoUnsafe[key],
/* onError=*/ (errorMessage: string) => {
console.warn(
`Skipping invalid node definition: ${key}. See debug log for more information.`
)
console.debug(errorMessage)
}
)
if (validatedDef !== null) {
objectInfo[key] = validatedDef
}
}
return objectInfo