How to determine whether code execution has error via knit2html

I'd like to use knit2html to execute a piece of R code, and want to know whether this piece of R code has error. But seems the return value of knit2html don't provide this info. Does anyone know how can I determine whether code execution has error via knit2html ?