import { HttpStatus, UnauthorizedException } from '@nestjs/common';

/**
 * RFC 6749 §5.2 — `invalid_client`: client authentication failed (unknown client_id, no
 * client authentication included, or unsupported authentication method). Returned with
 * HTTP 401.
 *
 * `statusCode` is included in the body so the NestJS Apollo driver's
 * `createTransformHttpErrorFn` sets `extensions.originalError`.
 */
export class InvalidClientError extends UnauthorizedException {
  constructor() {
    super({ statusCode: HttpStatus.UNAUTHORIZED, error: 'invalid_client' });
  }
}
