/** HTTP 非成功或其 body 为业务信封且 `code !== 0` 时抛出 */
export class LotteryApiBizError extends Error {
  readonly code: number;
  readonly data: unknown;

  constructor(message: string, code: number, data: unknown) {
    super(message);
    this.name = "LotteryApiBizError";
    this.code = code;
    this.data = data;
  }
}

/** body 不是约定的信封结构 */
export class LotteryApiEnvelopeError extends Error {
  constructor(message = "响应不是约定的 { code, msg, data }") {
    super(message);
    this.name = "LotteryApiEnvelopeError";
  }
}
