ERROR_CODES
expérimentaldepuis 0.1.0@legba-core/core
ERROR_CODES
Ce que ça fait
La table des codes d’erreur stables utilisés par @legba-core/core.
Signature
const ERROR_CODES: { INVALID_CONFIG: "LEGBA_INVALID_CONFIG" }
Paramètres
N/A — c’est une constante.
Retour
N/A — c’est une constante.
Erreurs
N/A.
Exemple minimal
import { ERROR_CODES } from "@legba-core/core";
console.log(ERROR_CODES.INVALID_CONFIG); // "LEGBA_INVALID_CONFIG"
Exemple complet
import { ERROR_CODES, LegbaError } from "@legba-core/core";
function isConfigError(error: unknown): error is LegbaError {
return error instanceof LegbaError && error.code === ERROR_CODES.INVALID_CONFIG;
}
Pièges
- Chaque nouveau code d’erreur ajouté ici doit aussi avoir son propre fichier
docs/api/<Symbole>.mds’il devient une classe d’erreur exportée séparément.