From 054ddf9a984bbee56e6c4912bd7f6a2bc5be2736 Mon Sep 17 00:00:00 2001 From: KwilLuke Date: Fri, 21 Jun 2024 11:56:31 -0500 Subject: [PATCH] Debug mode - for hitting parser errors DO NOT MERGE --- hooks/ide/use-compile-database.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/hooks/ide/use-compile-database.tsx b/hooks/ide/use-compile-database.tsx index 2db3e34..20a21fa 100644 --- a/hooks/ide/use-compile-database.tsx +++ b/hooks/ide/use-compile-database.tsx @@ -45,21 +45,20 @@ export default function useCompileDatabase( const parseKf = async (schema: string) => { const res = await globalThis.parseKuneiform(schema) - // console.log(res) + console.log(res) console.log({ ...res, json: res.json ? JSON.parse(res.json) : res.json }) // TODO: Remove res.json !== "" once we are confident that unhandled errors are cleaned up in KF. - if (!res.json && res.json !== "") { - // if(!res.json) { + // if (!res.json && res.json !== "") { + if(!res.json) { dispatch( setAlert({ type: "error", - text: "Failed to parse database definition.", + text: "A parser error occured. Please check the console.", }), ) - console.log('in failure block') throw new Error(`Failed to parse database definition. Response: ${res.toString()}`) } return JSON.parse(res.json) as IParseRes