Skip to content

Latest commit

 

History

History
26 lines (18 loc) · 707 Bytes

ARC0012.md

File metadata and controls

26 lines (18 loc) · 707 Bytes
title ARC0012: Built-in error thrown from an artifact
description Resolve ARC0012 in Arc TypeScript by replacing built-in errors thrown from commands, validators or read models with named domain error types.

What

A decorated command, validator, or read model throws new Error (or another built-in error). Rule: arc-core/arc0012.

Why

A domain-named error identifies the failure in logs and direct calls. This checks throw new ..., not indirect calls or imported aliases.

Bad

@command()
export class Register { handle() { throw new Error('Already registered'); } }

Good

@command()
export class Register { handle() { throw new AlreadyRegistered(); } }