# Function error contract — prompt for Gemma

Choose a consistent way to report different errors without confusing an absent result with a failure.

Canonical URL: https://boswidget.ru/en/function-error-contract-prompt-for-gemma/

Model: Gemma

Category: Code

Tags: errors, contract, function

![Function error contract](https://boswidget.ru/assets/images/text-preview-gm-dogovor-ob-oshibkah-funkcii-1200.0a9a2cf3779b.webp)

Function error contract

## Prompt

Function and its calls: {code}. Possible exceptional cases: {cases}. Language and project constraints: {rules}. Propose an error contract distinguishing an ordinary absent result, invalid input and an external failure. Show the signature and a short caller example. Do not silently change business behavior. For each case, state who decides whether to retry and what must not be hidden. Do not invent existing project classes or libraries.

## Template fields

- `{code}` — Function. Example input: Signature, implementation excerpt and example call
- `{cases}` — Edge cases. Example input: Possible errors and empty results
- `{rules}` — Constraints. Example input: Language, conventions and available handling mechanisms

## Launch

[Open Gemma in YesAI](https://yesai.su/en/gemma)
