# E4120

Compiler diagnostic name: `unhandled_error`.

The application might raise errors, but they are not handled.

Current MoonBit reports the ordinary unhandled re-raise pattern as
[E4122](./E4122.md). This page is retained for older compiler output that used
E4120 with the deprecated postfix error-handling syntax.

In MoonBit, we require programmers to explicitly annotate which functions may
raise errors. A function that re-raises an error must use a `raise` annotation
in its signature. To keep the current function from raising, handle the error
with `try ... catch` or materialize it to a `Result[T, E]` value with `try?`.

## Erroneous example

See [E4122](./E4122.md) for checked erroneous examples with the current syntax.

## Suggestion

You can either annotate the caller so it re-raises the error:

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

Or materialize the error to a `Result[T, E]` type with `try?`:

```{literalinclude} /sources/error_codes/4120_fixed/top_1.mbt
:language: moonbit
```
