# E0078

Warning name: `result_error_return`

A function returns `Result[T, E]` even though `E` is an error type.

For a failable API, prefer MoonBit's error effect, written `T raise E`. Keep a
`Result` return type only when success and failure are intentionally represented
as ordinary data. This migration warning is disabled by default.

## Erroneous example

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

## Suggestion

Return the success type and declare the error with `raise`.

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