diff --git a/powa/static/js/utils/sql.js b/powa/static/js/utils/sql.js index be74915d..9d520773 100644 --- a/powa/static/js/utils/sql.js +++ b/powa/static/js/utils/sql.js @@ -6,6 +6,11 @@ import { formatDialect, postgresql } from "sql-formatter"; hljs.registerLanguage("sql", pgsql); export function formatSql(value) { - value = formatDialect(value, { dialect: postgresql }); - return hljs.highlightAuto(value, ["sql"]).value; + try { + value = formatDialect(value, { dialect: postgresql }); + value = hljs.highlightAuto(value, ["sql"]).value; + } catch (error) { + console.error("Could not highlight SQL:", value); + } + return value; }