Skip to main content

Errors

Treat error codes as the stable contract. Human-readable messages can add context and may change; the code identifies the class of failure.

try {
const document = parseDocument(value);
} catch (error) {
if (isKeyHoldError(error) && error.code === 'invalid_document') {
// Ask for a fresh document.
}
}

The stable categories are invalid_json, unsupported_format, unsupported_version, invalid_document, unsupported_algorithm, invalid_parameter, invalid_private_key, and unlock_failed.