Files
taskgraph_ts/tasks/implementation/error/error-hierarchy.md
glm-5.1 131e3e929b Decompose architecture into 28 atomic implementation tasks
Break the @alkdev/taskgraph architecture specs into dependency-ordered
implementation tasks across 8 component directories: setup, schema,
error, graph, analysis, cost-benefit, frontmatter, api, and review.
Each task has clear acceptance criteria referencing specific architecture
docs. Three review tasks serve as quality gates at critical junction
points (schemas-and-errors, graph-complete, complete-library). The
dependency graph is validated acyclic with 9 topological levels enabling
significant parallelism across independent work streams.
2026-04-27 08:30:05 +00:00

1.7 KiB

id, name, status, depends_on, scope, risk, impact, level
id name status depends_on scope risk impact level
error/error-hierarchy Implement typed error class hierarchy pending
setup/project-init
narrow trivial phase implementation

Description

Implement the custom error classes in src/error/index.ts per errors-validation.md. All errors extend TaskgraphError which extends Error. Each subclass adds typed fields for programmatic error recovery.

Acceptance Criteria

  • src/error/index.ts exports:
    • TaskgraphError extends Error — base class
    • TaskNotFoundError extends TaskgraphError with taskId: string field
    • CircularDependencyError extends TaskgraphError with cycles: string[][] field
    • InvalidInputError extends TaskgraphError with field: string and message: string fields
    • DuplicateNodeError extends TaskgraphError with taskId: string field
    • DuplicateEdgeError extends TaskgraphError with prerequisite: string and dependent: string fields
  • Each error class sets this.name to the class name
  • Each error class properly extends the prototype chain (Object.setPrototypeOf(this, new.target.prototype))
  • InvalidInputError supports construction from TypeBox Value.Errors() output (receives structured field/path/value info)
  • CircularDependencyError receives string[][] where each inner array is an ordered cycle path
  • Unit tests verifying: correct instanceof chain, field access, .name property, error messages

References

  • docs/architecture/errors-validation.md — error types, when each is thrown
  • docs/architecture/api-surface.md — error documentation on specific methods

Notes

To be filled by implementation agent

Summary

To be filled on completion