# `Ash.Error.Framework.InvalidReturnType`
[🔗](https://github.com/ash-project/ash/blob/v3.27.8/lib/ash/error/framework/invalid_return_type.ex#L5)

This error is raised when a behaviour implementation returns a value that
does not match the behaviour's callback return type.

The `message` field should identify the behaviour module, the callback
(e.g. `module.function/arity`), and list the allowed return shapes so
implementors can fix the return value.

## Usage in behaviour wrappers

Wrappers should call the implementation and then match the result against
the allowed shapes, or use `Ash.BehaviourHelpers.call_and_validate_return/5`.
When the result does not match any allowed shape, raise this error with a
message in that format (behaviour module, callback, and allowed shapes).

# `exception`

```elixir
@spec exception(opts :: Keyword.t()) :: %Ash.Error.Framework.InvalidReturnType{
  __exception__: term(),
  bread_crumbs: term(),
  class: term(),
  message: term(),
  path: term(),
  splode: term(),
  stacktrace: term(),
  vars: term()
}
```

Create an `Elixir.Ash.Error.Framework.InvalidReturnType` without raising it.

## Keys

- :message

---

*Consult [api-reference.md](api-reference.md) for complete listing*
