private void handleException(
            ServiceRequestContext ctx, RpcResponse rpcRes, CompletableFuture<HttpResponse> httpRes,
            SerializationFormat serializationFormat, int seqId, ThriftFunction func, Throwable cause) {

        if (cause instanceof HttpStatusException || cause instanceof HttpResponseException) {
            httpRes.complete(HttpResponse.ofFailure(cause));
            return;
        }

        final TBase<?, ?> result = func.newResult();
        final HttpData content;
        if (func.setException(result, cause)) {
            content = encodeSuccess(ctx, rpcRes, serializationFormat, func.name(), seqId, result);
        } else {
            content = encodeException(ctx, rpcRes, serializationFormat, seqId, func.name(), cause);
        }

        respond(serializationFormat, content, httpRes);
    }
Returns the default {@link SerializationFormat} of this service.
thrift/thrift0.13/src/main/java/com/linecorp/armeria/server/thrift/THttpService.java