---
title: 'ARC0012: Built-in error thrown from an artifact'
editUrl: https://github.com/Cratis/Arc.TypeScript/edit/main/Documentation/code-analysis/ARC0012.md
description: Give domain failures a named error.
---


## 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

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

## Good

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