# LS1006: Domain Exception Is Misnamed or Open

## Intent

LS1006 is a compiler check that reports a DomainException subclass in Domain, the project that holds business rules, that is not sealed or whose name does not end in Exception, which hides which business rule failed. This page states what the rule reports, where the warning sits, and how to name and seal the exception.

## Reference

### What the rule enforces

LS1006 enforces [Reject business violations with Domain exceptions](https://litespec.dev/2.0.0/backend/dotnet/domain.md#reject-business-violations-with-domain-exceptions) (`litespec/backend/dotnet/domain#reject-business-violations-with-domain-exceptions`). It runs in Domain only. Its category is `LiteSpec.Domain`. It reports a warning and is enabled by default, as the [Analyzers overview](https://litespec.dev/2.0.0/analyzers/README.md) describes.

### What the rule reports

The rule reports a non-abstract `DomainException` subclass, direct or indirect, that is not sealed or whose name does not end in `Exception`. One type gets one diagnostic even when both checks fail. The diagnostic sits on the exception name.

### Failing example

```csharp
public class OrderRuleFailure : DomainException
{
    public OrderRuleFailure() : base("Broken.") { }
}
```

### Passing example

```csharp
public abstract class OrderException(string message) : DomainException(message);

public sealed class OrderAlreadyPlacedException() : OrderException("The order is already placed.");
```

### How to fix

Mark the leaf exception `sealed` and name it `{DomainType}{Reason}Exception`, keeping shared behavior in an abstract intermediate base.

## Notes

### What the rule ignores

The rule does not report abstract intermediate exception bases or sealed leaves named `{DomainType}{Reason}Exception`. It does not run outside Domain.
