Closed pedropark99 closed 8 months ago
Hey @yihui ! First of all, thank you for the review!
OBS: There is one task in the CI pipeline that is failling because of an outdated R version which is not supported by a dependency. Because I understand that the fix to this error is out of this PR scope, I will leave this error to you 😉.
I made the changes you requested in your review.
After that, I did a quick "debug walking" through the parser code, to get a better understanding on how it works. Then, I followed your instructions on how to get the chunk lines. With my latest changes, the error message is now on the following format:
> knit("C:\\Users\\pedro\\Desktop\\test.Rmd")
In partition_chunk(engine, code, block_index) :
Invalid YAML option format in chunk:
Failed to parse YAML inside code chunk at lines 15-19. Scanner error: mapping values are not allowed in this context at line 2, column 7
connection: db
label: test multiqueries -5
^~~~~~
I think that maybe the above message can still be improved if we change the last bit of the message like this:
Failed to parse YAML inside code chunk at lines 15-19. Mapping values are not allowed in a code chunk context. Error found at line 2, column 7 inside the code chunk.
connection: db
label: test multiqueries -5
^~~~~~
What is your opinion on it? If you think that this is a good addition, I can make the changes for us.
Now, in addition to parser.R
, since I basically changed the function signatures for partition_chunk()
and parse_block()
, I also had to make changes in two more places:
parse_block()
inside the unit tests to include the new block index parameter.partition_chunk()
documentation to include the new block index parameter.The changes above led me to also recompile all functions documentation with devtools::document()
.
Hello! This PR seeks to fulfill the objective proposed at the issue #2226
This PR adds a
tryCatch()
block to the step of parsing the YAML with the chunk options, and uses theerror
handler to build a better error message, as proposed in the issue #2226 . The new error message is in the following format:This error message was produced while knitting the following Rmd: