diff --git a/CHANGELOG.md b/CHANGELOG.md index 518ad46..182ff05 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 0.19.1 (2025-01-27) +Added logging for unprocessable data to help reporting. + # 0.19.0 (2025-01-24) Adding support for JSON and JSON5 files. You can now query these data types and create tables based on them. You can use JSONPath to traverse the JSON files and extract data from it. [See more in the documentation](http://hypersphere.blog/sql-seal/data-sources/json-and-json5.html). diff --git a/package.json b/package.json index c03e009..2bb42da 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sqlseal", - "version": "0.19.0", + "version": "0.19.1", "description": "A plugin for Obsidian that allows you to run SQL queries on your notes.", "main": "main.js", "scripts": { diff --git a/src/utils/ui.ts b/src/utils/ui.ts index ef9edbf..5bae428 100644 --- a/src/utils/ui.ts +++ b/src/utils/ui.ts @@ -11,11 +11,19 @@ export const displayError= (el: HTMLElement, text: string) => { } export const parseCell = (data: string, app: App) => { - if (data && typeof data === 'string' && data.startsWith('SQLSEALCUSTOM')) { - const parsedData = JSON.parse(data.slice('SQLSEALCUSTOM('.length, -1)) - return renderSqlSealCustomElement(parsedData, app) - } - return data + try { + if (data && typeof data === 'string' && data.startsWith('SQLSEALCUSTOM')) { + const parsedData = JSON.parse(data.slice('SQLSEALCUSTOM('.length, -1)) + return renderSqlSealCustomElement(parsedData, app) + } + return data + } catch (e) { + console.error('Error parsing cell with data:', data, e) + return createDiv({ + text: 'Parsing error', + cls: 'sqlseal-parse-error' + }) + } } type SqlSealAnchorElement = { diff --git a/styles.css b/styles.css index 7ed8518..3d46da4 100644 --- a/styles.css +++ b/styles.css @@ -133,4 +133,11 @@ .sqlseal-list.show-column-names .sqlseal-list-element-single .sqlseal-column-name { display: inline; +} + +.sqlseal-parse-error { + background: #b80f0f; + color: #FFF; + padding: 0.2em; + border-radius: 2px; } \ No newline at end of file