Errors

_archivesourcetypescript
Path: _archive/loom-stale-pre-sprint-snapshot/src/types/errors.tsRelative: loom-stale-pre-sprint-snapshot/src/types/errors.tsSubproject: _archiveCategory: archived
Lines: 68Bytes: 2,662Imports: 0Exports: 8

Content Preview

  1. /** Typed error hierarchy — never throw bare Error, never swallow. */
  2. export abstract class LoomError extends Error {
  3. abstract readonly code: string;
  4. readonly ts: string = new Date().toISOString();
  5. constructor(message: string, readonly detail?: unknown) {
  6. super(message);
  7. this.name = new.target.name;
  8. }
  9. toJSON(): { code: string; name: string; message: string; ts: string; detail?: unknown } {
  10. return { code: this.code, name: this.name, message: this.message, ts: this.ts, detai