errors
Skill627 starsChanged 6 days agoMITView on GitHub
How to define and check error classes in Ledger Live. Read when adding a new error, creating an errors.ts file, or checking an error's type.
6 other projects use a version of this.
Adopted by
Most recently taken up by
- e-reitbauer/habitstheir own version, first seen Nov 8, 2026
- aihu-project/aihutheir own version, first seen Oct 20, 2026
- ayrshare/ayrshare-social-media-api-claude-plugintheir own version, first seen Oct 13, 2026
- mr-ske1r/1c-ai-devstarttheir own version, first seen Oct 13, 2026
- VectorLabAU/skillstheir own version, first seen Oct 11, 2026
- gabriellst/codmtheir own version, first seen Aug 26, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- ayrshare/ayrshare-social-media-api-claude-plugin★ 19same name
- mr-ske1r/1c-ai-devstart★ 16same name
- aihu-project/aihu★ 4same name
- gabriellst/codm★ 4same name
- e-reitbauer/habits★ 1same name
- VectorLabAU/skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository70 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .github/copilot-instructions.mdCopilot instructions
- analyticsSkill
- batch-feature-devSkill
- ci-runnersSkill
- ci-workflow-refsSkill
- cleanupSkill
- client-idsSkill
- cloud-sync-moduleSkill
- codeownershipSkill
- coin-families-contractSkill
- coin-modulesSkill
- commentsSkill
- configurationSkill
- console-logSkill
- create-changesetSkill
- create-prSkill
- data-layer-advancedSkill
- debug-rn-native-crashSkill
- dependency-patchesSkill
- detect-data-leaksSkill
- device-intent-executorSkill
- devtools-import-boundarySkill
- dialogs-sliceSkill
- docs-migrateSkill
- docs-update-or-createSkill
- domain-dataSkill
- e2e-desktop-add-or-updateSkill
- e2e-desktop-onboardSkill
- e2e-earnSkill
- e2e-mobile-add-or-updateSkill
- e2e-mobile-onboardSkill
- e2e-swapSkill
- feature-devSkill
- fix-ciSkill
- flow-packageSkill
- get-pr-commentsSkill
- git-conventionsSkill
- i18n-keysSkill
- impacting-prsSkill
- knip-migrationSkill
- ldls-nativeSkill
- ldls-webSkill
- ledger-wallet-cliSkill
- legacy-migrationSkill
- mvvm-architectureSkill
- new-packageSkill
- package-public-apiSkill
- pnpm-resolutionSkill
- prefer-set-hasSkill
- pre-reviewSkill
- react-generalSkill
- rebuild-to-fix-lib-import-errorsSkill
- remove-feature-flagSkill
- run-buildsSkill
- run-e2e-ciSkill
- runner-imagesSkill
- run-testsSkill
- slack-pr-messageSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
3 rules. 0 are common, 0 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 62
Use the native second argument: super(message, { cause }).
- Very specific: line 80
Prefer error.name === "FooNotFound" over instanceof FooNotFound.
- Very specific: line 94
Use instanceof only when you are certain the error has not crossed a boundary (e.g.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Errors
Each package owns its errors in its own src/errors.ts, as plain native classes.
There is no shared errors lib: the former @ledgerhq/errors package has been removed.
Define errors
A package groups its errors in src/errors.ts. Extend Error directly and set a
stable name. The name string is the contract — keep it stable, it is what
survives across process/serialization boundaries.
// message-only
export class FooNotFound extends Error {
override name = "FooNotFound";
}
// with a default message
export class InvalidChallenge extends Error {
override name = "InvalidChallenge";
constructor() {
super("backend returned an invalid challenge");
}
}
// with extra fields
export class HttpError extends Error {
override name = "HttpError";
readonly status: number | undefined;
constructor(message: string, status?: number) {
super(message);
this.status = status;
}
}Group a family under a per-package base class so callers can catch the whole set. An excerpt of
domain/entity/contact/src/errors.ts, which holds
the full family:
export class ContactError extends Error {
override name: string = "ContactError";
}
export class InvalidContactNameError extends ContactError {
override name = "InvalidContactNameError" as const;
constructor() {
super("Expected letters, spaces, or digits");
}
}cause
Use the native second argument: super(message, { cause }). Error cause was
standardized in ES2022 and is supported by modern runtimes; its TypeScript typing
(ErrorOptions) requires lib: es2022.error (i.e. es2022). Coin modules and
some older packages still target es2020 — there, declare and assign manually:
export class BroadcastError extends Error {
override name = "BroadcastError";
cause?: unknown;
constructor(message: string, cause?: unknown) {
super(message);
this.cause = cause;
}
}Check error type: prefer error.name
Prefer error.name === "FooNotFound" over instanceof FooNotFound.
instanceof breaks once an error crosses a boundary — desktop/mobile IPC, worker
messaging, or the external @ledgerhq/coin-module-framework — because the object
is rebuilt and loses its prototype. The name string always survives.
// ✅ survives serialization
if (error instanceof Error && error.name === "FooNotFound") { … }
// ⚠️ only works in-process, before any serialization
if (error instanceof FooNotFound) { … }Use instanceof only when you are certain the error has not crossed a boundary
(e.g. caught in the same module that threw it) and you need the typed fields.
Where errors live
- Logic in one package → that package's
src/errors.ts. - Used only by an app → that app's errors file, such as
apps/ledger-live-desktop/src/errors.ts. Mobile has no app-level errors file yet: add one at the same place the first time it needs one. - Shared by several coin modules →
libs/ledger-wallet-framework/src/errors.ts(@ledgerhq/ledger-wallet-framework/errors), the shared home below the coin layer.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

