Skip to content

quarto_inspect() should forward error message #768

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

Closed
salim-b opened this issue Apr 29, 2025 · 2 comments
Closed

quarto_inspect() should forward error message #768

salim-b opened this issue Apr 29, 2025 · 2 comments

Comments

@salim-b
Copy link
Contributor

salim-b commented Apr 29, 2025

Currently, quarto_inspect() does not forward the error message when it fails:

Sys.setenv(NO_COLOR = "1")

# create new quarto book project
path_tmp <- tempdir()
path_tmp_proj <- file.path(path_tmp, "test")

quarto::quarto_create_project(name = "test",
                              type = "book",
                              dir = path_tmp,
                              no_prompt = TRUE)
#> WARN: No 'title' for project provided in `quarto create project`. Using 'test' as default.
#> Creating project at /tmp/Rtmpin5zHs/test:
#>   - Created _quarto.yml
#>   - Created index.qmd
#>   - Created intro.qmd
#>   - Created summary.qmd
#>   - Created references.qmd
#>   - Created cover.png
#>   - Created references.bib

# quarto inspect runs successfully
quarto::quarto_inspect(input = path_tmp_proj) |> is.list()
#> [1] TRUE

# rename intro chpt file to trigger error
file.rename(from = file.path(path_tmp_proj, "intro.qmd"),
            to = file.path(path_tmp_proj, "no_intro.qmd"))
#> [1] TRUE

# now quarto inspect fails – without forwarding the error
quarto::quarto_inspect(input = path_tmp_proj)
#> Error in `quarto::quarto_inspect()`:
#> ✖ Error running quarto cli.
#> Caused by error:
#> ! System command 'quarto' failed

Created on 2025-04-29 with reprex v2.1.1

The error message emitted by the underlying quarto inspect is the following in the above case:

$ quarto inspect /tmp/Rtmpin5zHs/test
ERROR: Book chapter 'intro.qmd' not found

Stack trace:
    at throwInputNotFound (file:///opt/quarto/bin/quarto.js:100761:19)
    at findInputs (file:///opt/quarto/bin/quarto.js:100792:17)
    at eventLoopTick (ext:core/01_core.js:175:7)
    at async findChapters (file:///opt/quarto/bin/quarto.js:100804:13)
    at async bookRenderItems (file:///opt/quarto/bin/quarto.js:100807:5)
    at async Object.bookProjectConfig [as config] (file:///opt/quarto/bin/quarto.js:100712:25)
    at async projectContext (file:///opt/quarto/bin/quarto.js:82390:38)
    at async inspectConfig (file:///opt/quarto/bin/quarto.js:110378:21)
    at async Command.actionHandler (file:///opt/quarto/bin/quarto.js:110497:20)
    at async Command.execute (file:///opt/quarto/bin/quarto.js:8253:13)

ERROR: Book chapter 'intro.qmd' not found immediately indicates what's the problem, so we should really forward it.

@gaborcsardi
Copy link
Member

Can you please explain why this is a cli issue?

@salim-b
Copy link
Contributor Author

salim-b commented Apr 29, 2025

OMG, sorry, completely wrong repo! 🙈

@salim-b salim-b closed this as not planned Won't fix, can't repro, duplicate, stale Apr 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants