EGRESS_ERROR_CODES
expérimentaldepuis 0.1.0@legba-core/realtime
EGRESS_ERROR_CODES
Ce que ça fait
La table des codes d’erreur stables liés à l’enregistrement (Egress).
Signature
const EGRESS_ERROR_CODES: {
INVALID_EGRESS_REQUEST: "LEGBA_INVALID_EGRESS_REQUEST";
ROOM_NOT_FOUND: "LEGBA_EGRESS_ROOM_NOT_FOUND";
EGRESS_NOT_FOUND: "LEGBA_EGRESS_NOT_FOUND";
EGRESS_FAILED: "LEGBA_EGRESS_FAILED";
}
Paramètres
N/A — c’est une constante.
Retour
N/A — c’est une constante.
Erreurs
N/A.
Exemple minimal
import { EGRESS_ERROR_CODES } from "@legba-core/realtime";
console.log(EGRESS_ERROR_CODES.EGRESS_NOT_FOUND); // "LEGBA_EGRESS_NOT_FOUND"
Exemple complet
import { EGRESS_ERROR_CODES, LegbaEgressError } from "@legba-core/realtime";
function isEgressMissing(error: unknown): boolean {
return error instanceof LegbaEgressError && error.code === EGRESS_ERROR_CODES.EGRESS_NOT_FOUND;
}
Pièges
ROOM_NOT_FOUND(la salle n’existe pas) etEGRESS_NOT_FOUND(l’egressId n’existe pas) sont deux codes distincts : ne pas les confondre en supposant qu’une salle manquante et un enregistrement manquant se comportent pareil.