# E4226

Compiler diagnostic name: `constr_any_pattern_scrutinee_not_error`.

The wildcard constructor pattern `Type::_` is being matched against a value
whose type is not `Error`.

`Type::_` selects every constructor belonging to one suberror type while
matching the open `Error` type. It is not an alternative spelling for an
ordinary exhaustive match on a value already typed as that suberror.

## Erroneous example

```{literalinclude} /sources/error_codes/4226_error/top.mbt
:language: moonbit
```

## Suggestion

Use `Type::_` when matching an `Error`, and retain a final `_` branch for other
suberror types. When the matched value already has the concrete suberror type,
list its constructors normally.

```{literalinclude} /sources/error_codes/4226_fixed/top.mbt
:language: moonbit
```
