Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve error message when EJS execution fails #11529

Open
cscheid opened this issue Nov 25, 2024 · 2 comments
Open

Improve error message when EJS execution fails #11529

cscheid opened this issue Nov 25, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request listings
Milestone

Comments

@cscheid
Copy link
Collaborator

cscheid commented Nov 25, 2024

See https://github.com/beyond2060/quarto-bug-reproduction for a minimal example.

@cscheid cscheid added enhancement New feature or request listings labels Nov 25, 2024
@cscheid cscheid added this to the v1.7 milestone Nov 25, 2024
@cscheid cscheid self-assigned this Nov 25, 2024
@cderv
Copy link
Collaborator

cderv commented Nov 25, 2024

For more context the error traceback is

❯ quarto render index.qmd
ERROR: TypeError: Cannot read properties of undefined (reading 'split')

Stack trace:
    at eval (eval at <anonymous> (https://cdn.skypack.dev/-/[email protected]/dist=es2019,mode=imports/unoptimized/template.js:58:12), <anonymous>:23:22)
    at renderEjs (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/core/ejs.ts:39:16)
    at templateMarkdownHandler (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/project/types/website/listing/website-listing-template.ts:183:26)
    at markdownHandler (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/project/types/website/listing/website-listing.ts:352:14)
    at file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/project/types/website/listing/website-listing.ts:179:7
    at Array.forEach (<anonymous>)
    at listingHtmlDependencies (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/project/types/website/listing/website-listing.ts:177:22)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async Object.formatExtras (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/project/types/website/website.ts:235:39)
    at async runPandoc (file:///C:/Users/chris/Documents/DEV_R/quarto-cli/src/command/render/pandoc.ts:392:10)

And it happens because

  • A post does not have a title
  • The custom EJS is doing
     <a href="<%- item.path %>" class="title listing-title" data-original-href="<%- item.path %>"><%= item.title.split('*').join('') %></a>

item.title being undefined, it throws an error. Though it requires investigation to understand what and where.

@cscheid
Copy link
Collaborator Author

cscheid commented Nov 25, 2024

We should be catching any exception there, though, and reporting the file where this fails to the user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request listings
Projects
None yet
Development

No branches or pull requests

2 participants