File size: 791 Bytes
46252cd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import { ConflictException } from '@nestjs/common';

/**
 * Thrown by the engine layer when an operation requires a connected, READY
 * WhatsApp client but the session is not in that state — e.g. it was just
 * disconnected from the phone, is still initializing, or is reconnecting.
 *
 * Extends NestJS `ConflictException` so it maps to **HTTP 409** through NestJS's
 * built-in exception handler — i.e. it does NOT depend on a custom global filter
 * being registered. API callers (and the dashboard) get a clear, retryable
 * "session not connected" error instead of a generic 500 Internal Server Error.
 */
export class EngineNotReadyError extends ConflictException {
  constructor(message = 'Session is not connected. The WhatsApp client is not ready.') {
    super(message);
  }
}