---
displayed_sidebar: homepage
---

import ParameterTypes from "@site/src/components/ParameterTypes"

# MedusaErrorHandlerFunction

 **MedusaErrorHandlerFunction**: (`error`: `any`, `req`: [MedusaRequest](../interfaces/medusa.MedusaRequest.mdx), `res`: [MedusaResponse](medusa.MedusaResponse.mdx), `next`: [MedusaNextFunction](medusa.MedusaNextFunction.mdx)) => Promise&#60;void&#62; \| `void`

## Type declaration

### Parameters

<ParameterTypes parameters={[
  {
    "name": "error",
    "type": "`any`",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "req",
    "type": "[MedusaRequest](../interfaces/medusa.MedusaRequest.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": [
      {
        "name": "allowedProperties",
        "type": "`string`[]",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "errors",
        "type": "`string`[]",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "filterableFields",
        "type": "`Record<string, unknown>`",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "includes",
        "type": "`Record<string, boolean>`",
        "description": "",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "listConfig",
        "type": "[FindConfig](../interfaces/medusa.FindConfig.mdx)&#60;unknown&#62;",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "retrieveConfig",
        "type": "[FindConfig](../interfaces/medusa.FindConfig.mdx)&#60;unknown&#62;",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "scope",
        "type": "[MedusaContainer](medusa.MedusaContainer-2.mdx)",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "user",
        "type": "`Object`",
        "description": "",
        "optional": true,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "validatedBody",
        "type": "`unknown`",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      },
      {
        "name": "validatedQuery",
        "type": "[RequestQueryFields](../interfaces/medusa.RequestQueryFields.mdx) & `Record<string, unknown>`",
        "description": "",
        "optional": false,
        "defaultValue": "",
        "expandable": false,
        "children": []
      }
    ]
  },
  {
    "name": "res",
    "type": "[MedusaResponse](medusa.MedusaResponse.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  },
  {
    "name": "next",
    "type": "[MedusaNextFunction](medusa.MedusaNextFunction.mdx)",
    "description": "",
    "optional": false,
    "defaultValue": "",
    "expandable": false,
    "children": []
  }
]} expandUrl="https://docs.medusajs.com/development/entities/repositories#retrieving-a-list-of-records"/>

### Returns

<ParameterTypes parameters={[
  {
    "name": "Promise&#60;void&#62; \\| void",
    "type": "Promise&#60;void&#62; \\| `void`",
    "optional": true,
    "defaultValue": "",
    "description": "",
    "expandable": false,
    "children": []
  }
]} />
