class TransportExceptionConverter implements ExceptionConverter<HerajException> {

  @Override
  public HerajException convert(final Throwable target) {
    logger.trace("Convert raw exception {}", target.toString());
    if (target instanceof HerajException) {
      return (HerajException) target;
    } else if (target instanceof StatusRuntimeException) {
      return convertGrpcBasisException((StatusRuntimeException) target);
    } else {
      return new HerajException(target);
    }
  }

}