private static WriteContinuation doRender( CompiledTemplate template, Scoper scoper, AdvisingAppendable out, RenderContext context) throws IOException { RenderResult result; try (WithScope scope = scoper.enter()) { result = template.render(out, context); } catch (Throwable t) { rewriteStackTrace(t); Throwables.propagateIfInstanceOf(t, IOException.class); throw Throwables.propagate(t); } if (result.isDone()) { return Continuations.done(); } return new WriteContinuationImpl(result, scoper, context, out, template); }