yihui/knitr — Issue #85: Output file is not generated if an error occurs in \Sexpr
Author: renozao
Created: 2012-01-17 12:15:29+00:00
State: open

I think it would be better to generate the output file in any case with a special Latex command to highlight the error, as it is done for code chunks.

Some message should also be generated in the R console in case of an error, otherwise things seem to have gone smooth where they haven't...
Thank you.

Renaud

-----------------------
To test:
```R
<>=
stop("ERROR HERE")
@
```
the output document is generated (with error comments ) but no error or message appears in the R session:

```
|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> | 50%
errorchunk:

|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>| 100%
ordinary text without R code

output file: /home/renaud/knit/test.tex
```

But with:

```R
\Sexpr{y}
```
no output is generated and an error occurs in the R session:

```
|>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>| 100%
inline R code fragments

Error in eval(expr, envir, enclos) : object 'y' not found
```