Skip to content

Free, Open Source, Self-Hosted WhatsApp API Gateway

refactor(openapi): share the not-started 400 description

Yudhi Armyndharisb6fdfe58cd9d
diff --git a/src/common/openapi/engine-status-responses.ts b/src/common/openapi/engine-status-responses.ts
index bde0c9e10..f8ef74e83 100644
--- a/src/common/openapi/engine-status-responses.ts
+++ b/src/common/openapi/engine-status-responses.ts
@@ -22,6 +22,15 @@ export const ENGINE_NOT_READY_409 =
'still reads `ready`: WhatsApp Web periodically reloads its own page and the engine re-injects ' +
'into it, and for those few seconds the answer is a `409` naming the reload; retry shortly.';
+/**
+ * `EngineRegistry.require()`'s default `BadRequestException` (400): the session has no engine at all,
+ * the case ENGINE_NOT_READY_409 leaves out. The catalog and status routes answer this with a 404
+ * instead; see SESSION_NOT_STARTED_404.
+ */
+export const SESSION_NOT_STARTED_400 =
+ 'The session is not started: no engine is running for it (never started, stopped, or logged out). ' +
+ 'Start the session and retry.';
+
/**
* `EngineNotReadyError` (409) on `POST /sessions/:sessionId/pairing-code`, where the generic wording
* above points the caller at the wrong state: both engines accept a pairing request only while the