# Error handling with API integration using REST

**URL:** <https://community.make.com/t/error-handling-with-api-integration-using-rest/71009>\
**Category:** Questions\
**Tags:** error, connections\
**Created:** [February 22, 2025, 3:43pm UTC](https://community.make.com/t/error-handling-with-api-integration-using-rest/71009 "2025-02-22T15:43:03Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ademilson\_Tonato](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@Ademilson\_Tonato](https://community.make.com/u/Ademilson_Tonato)\
**Post date:** [February 22, 2025, 3:43pm UTC](https://community.make.com/t/error-handling-with-api-integration-using-rest/71009/1 "2025-02-22T15:43:03Z")

</div>

Hey there,

I am new to MAKE and am building an integration with my API. I am setting up my custom app, and it works fine; however, I’ve been struggling to fix an issue with error handling.

My API responses follow this pattern:

```auto
{
  "success": boolean,
  "error": text or null,
  "details": text or array, // only available if "error" has some data
  "data": json,
}

```

**Module communication code:**

As you can see I’ve added the “error” code everywhere to make sure that the error would appear, but still doesn’t appear anywhere.

```auto
{
    "url": "https://api.firecrawl.dev/v1/scrape",
    "body": "{{parameters}}",
    "method": "POST",
    "response": {
        "output": {
            "body": "{{body}}",
            "headers": "{{headers}}",
            "statusCode": "{{statusCode}}",
            "result":"{{body}}",
            "error": {
                "type": "RuntimeError",
                "message": "[{{statusCode}}] {{body.error.message}}",
                "400": {
                    "type": "DataError",
                    "message": "[{{statusCode}}] {{body.error.message}}"
                },
                "500": {
                    "type": "ConnectionError",
                    "message": "[{{statusCode}}] {{body.error.message}}"
                }
            }
        },
        "error": {
                "type": "RuntimeError",
                "message": "[{{statusCode}}] {{body.error.message}}",
                "400": {
                    "type": "DataError",
                    "message": "[{{statusCode}}] {{body.error.message}}"
                },
                "500": {
                    "type": "ConnectionError",
                    "message": "[{{statusCode}}] {{body.error.message}}"
                }
            }
    }
}

```

When testing, everything works fine when the API doesn’t return errors. However, when an error occurs, it only shows this:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/9/4/9438b3fb67517440d11ae89e623dc704ca7b43a8.png)

Additionally, you can check the **MAKE Dev Tools** body response, which contains exactly what should be displayed to the user.

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/7/d/7d2bf9bb2e39e6531f73ee5510568ef8e2b1ad9a.png)

All help is welcome, thanks

---

<div class="post-metadata">

**Author:** ![L\_Duperval](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/l_duperval/32/44239_2.png) [@L\_Duperval](https://community.make.com/u/L_Duperval)\
**Post date:** [February 23, 2025, 2:43am UTC](https://community.make.com/t/error-handling-with-api-integration-using-rest/71009/2 "2025-02-23T02:43:53Z")

</div>

Hi @Ademilson_Tonato and welcome to the Make Community!

The reason you are seein this is that your HTTP call returns error code 400. Make considers that as an error and throws an error without reading the response. If you don’t wan’t that to happen, set this option to “No” in the HTTP module:

 ![image](https://europe1.discourse-cdn.com/flex013/uploads/make/original/3X/f/5/f56527ab3953b6eec78d56b3a543655a954c20cc.png)

L

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [February 23, 2025, 9:26am UTC](https://community.make.com/t/error-handling-with-api-integration-using-rest/71009/3 "2025-02-23T09:26:59Z")

</div>

Welcome to the Make community!

Instead of referencing `{{body.error.message}}` (which doesn’t exist),

```plaintext
  {
    "type": "RuntimeError",
    "message": "[{{statusCode}}] {{body.error.message}}"
  }

```

You should reference the `details` instead,

```plaintext
  {
    "type": "RuntimeError",
    "message": "[{{statusCode}}] {{ifempty(body.details.1.message; body.details)}}"
  }

```

Hope this helps! Let me know if there are any further questions or issues.

— @samliew

P.S.: Investing some effort into the [Make Academy](https://academy.make.com) will save you lots of time and frustration using Make.

---

<div class="post-metadata">

**Author:** ![Ademilson\_Tonato](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@Ademilson\_Tonato](https://community.make.com/u/Ademilson_Tonato)\
**Post date:** [February 25, 2025, 5:41pm UTC](https://community.make.com/t/error-handling-with-api-integration-using-rest/71009/4 "2025-02-25T17:41:17Z")

</div>

Hello, thank you for answering, @samliew

Should I place this under  
**response → output → error** ,

**response → error** ,

or both as I currently have it?

```typescript
{
  "url": "https://api.firecrawl.dev/v1/scrape",
  "body": "{{parameters}}",
  "method": "POST",
  "response": {
      "output": {
          "body": "{{body}}",
          "headers": "{{headers}}",
          "statusCode": "{{statusCode}}",
          "result": "{{body}}",
	   
          // Should I place it here?
          "error": {
              "type": "RuntimeError",
              "message": "[{{statusCode}}] {{ifempty(body.details.1.message; body.details)}}",
              "400": {
                  "type": "DataError",
                  "message": "[{{statusCode}}] {{body.error.message}}"
              },
              "500": {
                  "type": "ConnectionError",
                  "message": "[{{statusCode}}] {{body.error.message}}"
              }
          }
      },

      // Or should I place it here?
      "error": {
        "type": "RuntimeError",
        "message": "[{{statusCode}}] {{ifempty(body.details.1.message; body.details)}}",
        "400": {
            "type": "DataError",
            "message": "[{{statusCode}}] {{body.error.message}}"
        },
        "500": {
            "type": "ConnectionError",
            "message": "[{{statusCode}}] {{body.error.message}}"
        }
      }
  }
}

```

---

<div class="post-metadata">

**Author:** ![samliew](https://dub1.discourse-cdn.com/flex013/user_avatar/community.make.com/samliew/32/13327_2.png) [@samliew](https://community.make.com/u/samliew)\
**Post date:** [February 26, 2025, 12:22am UTC](https://community.make.com/t/error-handling-with-api-integration-using-rest/71009/5 "2025-02-26T00:22:46Z")

</div>

response → error is correct.

For more information, see [Error handling | Make Developer Hub](https://developers.make.com/custom-apps-documentation/app-structure/base/error-handling#with-error-handling)

Hope this helps! Let me know if there are any further questions or issues.

— @samliew

P.S.: Investing some effort into the [Make Academy](https://academy.make.com) will save you lots of time and frustration using Make.

---

<div class="post-metadata">

**Author:** ![system](https://europe1.discourse-cdn.com/flex013/uploads/make/original/1X/9786f7887a39f4a0fef4d09346ab5b54ce20222b.svg) [@system](https://community.make.com/u/system)\
**Post date:** [March 28, 2025, 12:23am UTC](https://community.make.com/t/error-handling-with-api-integration-using-rest/71009/6 "2025-03-28T00:23:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
