brain / console /src /lib /ingestContract.mjs
Leon4gr45's picture
Deploy complete BrainAPI source d15a5889e878
2f1e7ff verified
Raw History Blame Contribute Delete
306 Bytes
export function requireAcceptedTask(status, payload) {
const id = payload?.task_id;
if (status !== 202 || typeof id !== "string" || ["", "none", "null"].includes(id.trim().toLowerCase())) {
throw new Error("INGESTION_CONTRACT_ERROR: expected HTTP 202 with a non-empty task_id");
}
return id;
}