# Custom error in rules

**URL:** <https://community.auth0.com/t/custom-error-in-rules/10917>\
**Category:** Get Help\
**Tags:** rules, auth0\
**Created:** [April 16, 2018, 6:56pm UTC](https://community.auth0.com/t/custom-error-in-rules/10917 "2018-04-16T18:56:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zharkyn](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@zharkyn](https://community.auth0.com/u/zharkyn)\
**Post date:** [April 16, 2018, 6:56pm UTC](https://community.auth0.com/t/custom-error-in-rules/10917/1 "2018-04-16T18:56:27Z")

</div>

For returning an error, in examples, new UnauthorizedError(“A message here”) is returned. Which is returned to my SPA as { error: “unauthorized”, errorDescription: “A message here” }.

Is it possible to have a custom error, so it will return something like { error: “custom\_error”, errorDescription: “A message here” }?

If not, then is it possible to attach some data to the error?

---

<div class="post-metadata">

**Author:** ![jerdog](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/jerdog/32/11231_2.png) [@jerdog](https://community.auth0.com/u/jerdog)\
**Post date:** [April 16, 2018, 9:27pm UTC](https://community.auth0.com/t/custom-error-in-rules/10917/2 "2018-04-16T21:27:24Z")

</div>

Have you looked at our docs?

> **[Customize Lock Error Messages](https://auth0.com/docs/customize/customize-lock-error-messages)**
>
> Customizing error messages with Lock v11

---

<div class="post-metadata">

**Author:** ![zharkyn](https://upload.wikimedia.org/wikipedia/commons/thumb/7/7c/User_font_awesome.svg/768px-User_font_awesome.svg.png) [@zharkyn](https://community.auth0.com/u/zharkyn)\
**Post date:** [April 16, 2018, 9:40pm UTC](https://community.auth0.com/t/custom-error-in-rules/10917/3 "2018-04-16T21:40:20Z")

</div>

Hey, seems like what I need, thanks!

---

<div class="post-metadata">

**Author:** ![konrad.sopala](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/konrad.sopala/32/13516_2.png) [@konrad.sopala](https://community.auth0.com/u/konrad.sopala)\
**Post date:** [December 17, 2018, 10:56am UTC](https://community.auth0.com/t/custom-error-in-rules/10917/4 "2018-12-17T10:56:44Z")

</div>


