/**
 * Errors raised by `@shade/transport-webrtc`. All extend
 * `TransferTransportError` (re-exported by `@shade/transfer`) so that
 * `FallbackTransferTransport` automatically demotes us when WebRTC is
 * dead and HTTP/WS picks up.
 */
import { TransferTransportError } from '@shade/transfer';

export class WebRtcSignalingError extends TransferTransportError {
  override readonly name = 'WebRtcSignalingError';
  constructor(message: string) {
    super(`[webrtc-signaling] ${message}`);
  }
}

export class WebRtcConnectError extends TransferTransportError {
  override readonly name = 'WebRtcConnectError';
  constructor(message: string) {
    super(`[webrtc-connect] ${message}`);
  }
}

export class WebRtcDataChannelError extends TransferTransportError {
  override readonly name = 'WebRtcDataChannelError';
  constructor(message: string) {
    super(`[webrtc-datachannel] ${message}`);
  }
}

export class WebRtcTimeoutError extends TransferTransportError {
  override readonly name = 'WebRtcTimeoutError';
  constructor(message: string) {
    super(`[webrtc-timeout] ${message}`);
  }
}
