Handle exceptions thrown in the render function.