package net.northking.cctp.common.exception;

import java.text.MessageFormat;

/**
 * 反馈到请求端的异常
 *
 * @author xiusong.xie
 * @since 1.0
 */
public class PlatformRuntimeException extends RuntimeException
{
  private final transient PlatformError error;

  public PlatformRuntimeException(PlatformError error)
  {
    super(error.getMsg());
    this.error = error;
  }

  public PlatformRuntimeException(PlatformError error, Object... params)
  {
    super(MessageFormat.format(error.getMsg(), params));
    this.error = error;
  }

  public PlatformRuntimeException(PlatformError error, Throwable cause)
  {
    super(error.getMsg(), cause);
    this.error = error;
  }

  public PlatformError getError()
  {
    return error;
  }
}
