# Custom Error messages

**URL:** <https://community.postman.com/t/custom-error-messages/17724>\
**Category:** Help Hub\
**Tags:** tests\
**Created:** [November 16, 2020, 8:40am UTC](https://community.postman.com/t/custom-error-messages/17724 "2020-11-16T08:40:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![JBird20](https://avatars.discourse-cdn.com/v4/letter/j/3d9bf3/32.png) [@JBird20](https://community.postman.com/u/JBird20)\
**Post date:** [November 16, 2020, 8:40am UTC](https://community.postman.com/t/custom-error-messages/17724/1 "2020-11-16T08:40:17Z")

</div>

Hi,

I have done a Google, but cannot find a specific answer to my question. I am using PM.TEST to do includes / to.be.true etx.

As the includes scans all text on the page the error message is not clear (as it provides all text before the lookup term).

Is there any way to add a custom message onto:

```
pm.test("Confirm Expected User Details are on Page : Title", function(){

    pm.expect(pm.response.text()).to.include("Mr");
    // On Fail (error"Mr was not found in the source returned"
});

```

or

```
pm.test("Confirm Expected User Details are on Page : Married / Unmarried", function(){

    const responseText = pm.response.text();

    const hasItemDetails = (responseText.includes('Married') || responseText.includes('UnMarried'));    

    pm.expect(hasItemDetails).to.be.true;
   // Error("Marriage Information not present in source")

});

```

Not the information does not come back in JSON but HTML.

Looking to replace // with proper code

Thanks

---

<div class="post-metadata">

**Author:** ![yusuftaymann](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/yusuftaymann/32/6160_2.png) [@yusuftaymann](https://community.postman.com/u/yusuftaymann)\
**Post date:** [November 16, 2020, 8:52am UTC](https://community.postman.com/t/custom-error-messages/17724/2 "2020-11-16T08:52:33Z")

</div>

Hey @JBird20 ,

Welcome to the community 👏

You can review this document. The assertion message should be in the second parameter.

> **[Assertion Styles - Chai](https://www.chaijs.com/guide/styles/)**

```
   pm.test("Confirm Expected User Details are on Page : Married / Unmarried", function(){

    const responseText = pm.response.text();

    const hasItemDetails = (responseText.includes('Married') || responseText.includes('UnMarried'));    

    pm.expect(hasItemDetails, "Marriage Information not present in source").to.be.true;

});
```
