thegetty / quire

A multi-package repository for the Quire multiformat publishing framework
https://quire.getty.edu/
BSD 3-Clause "New" or "Revised" License
89 stars 10 forks source link

Improved error messaging needed with missing `id` in references.yaml #933

Open Erin-Cecele opened 2 months ago

Erin-Cecele commented 2 months ago

Before proceeding, make sure there isn’t an existing issue for this bug.

Expected Behavior

If an id value is null in references.yaml, Quire should output a helpful error message and leave the citation unprocessed.

Actual Behavior

Instead, you don't receive an error message until adding citation shortcodes, and even then you just receive an obscure and vague error message that makes it hard to determine the root cause.

Steps to Reproduce

1) create a references.yaml file 2) leave one of the id blank 3) add a citation shortcode 4) run quire preview

Version Numbers

[ancient-glass] quire-cli 1.0.0-rc.11 quire-11ty 1.0.0-rc.16 starter https://github.com/thegetty/quire-starter-default@2.6.0 [System] quire-cli 1.0.0-rc.11 node v18.17.0 npm 9.6.7 os Darwin 21.6.0

Web Browser

Chrome but this is irrelevant to the issue

Relevant Terminal/Shell Output

[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble rendering liquid template ./content/history.md (via TemplateContentRenderError)
[11ty] 2. Cannot read properties of null (reading 'localeCompare'), file:./content/history.md, line:32, col:572 (via RenderError)
[11ty] 3. Cannot read properties of null (reading 'localeCompare') (via TypeError)
[11ty] 
[11ty] Original error stack trace: TypeError: Cannot read properties of null (reading 'localeCompare')
[11ty]     at /Users/edunigan/GitHub/ancient-glass/_plugins/shortcodes/cite.js:81:25
[11ty]     at Array.find (<anonymous>)
[11ty]     at findCitationReference (/Users/edunigan/GitHub/ancient-glass/_plugins/shortcodes/cite.js:80:29)
[11ty]     at Object.<anonymous> (/Users/edunigan/GitHub/ancient-glass/_plugins/shortcodes/cite.js:92:22)
[11ty]     at Object.<anonymous> (/Users/edunigan/GitHub/ancient-glass/_plugins/components/shortcodeFactory.js:17:75)
[11ty]     at Object.<anonymous> (/Users/edunigan/GitHub/ancient-glass/node_modules/@11ty/eleventy/src/BenchmarkGroup.js:32:26)
[11ty]     at Tag.render (/Users/edunigan/GitHub/ancient-glass/node_modules/@11ty/eleventy/src/Engines/Liquid.js:170:39)
[11ty]     at render.next (<anonymous>)
[11ty]     at toPromise (/Users/edunigan/GitHub/ancient-glass/node_modules/liquidjs/dist/liquid.node.cjs.js:479:32)
[11ty]     at async toPromise (/Users/edunigan/GitHub/ancient-glass/node_modules/liquidjs/dist/liquid.node.cjs.js:487:25)
[11ty] Wrote 0 files in 11.61 seconds (v2.0.1)


### Supporting Information

_No response_