exceptionCodec.getCodec(),
t);
contextChain.postWriteException(t);
} else {
// unexpected exception
TApplicationException applicationException =
new TApplicationException(INTERNAL_ERROR,
"Internal error processing " + method.getName());
applicationException.initCause(t);
LOG.error("Internal error processing {}", method.getName(), t);
// Application exceptions are sent to client, and the connection can be reused
out.writeMessageBegin(new TMessage(name, TMessageType.EXCEPTION, sequenceId));
applicationException.write(out);
out.writeMessageEnd();
out.getTransport().flush();
contextChain.postWriteException(applicationException);
}