fhenix-client-sdk-error-handling
Installation
SKILL.md
Fhenix Client SDK — Error Handling
Overview
All SDK operations return values directly and throw typed CofheError objects on failure (replacing the Result wrapper used by legacy cofhejs). Each CofheError has a code (CofheErrorCode enum) and a human-readable message. Use isCofheError(err) to narrow.
import { isCofheError, CofheErrorCode, Encryptable } from '@cofhe/sdk';
try {
const [encrypted] = await client.encryptInputs([Encryptable.uint32(42n)]).execute();
} catch (err) {
if (isCofheError(err)) {
console.error(err.code); // CofheErrorCode enum value
console.error(err.message); // human-readable description
}
}