# API error handling in scripts

**URL:** <https://community.fibery.io/t/api-error-handling-in-scripts/2062>\
**Category:** API & Programming\
**Created:** [September 28, 2021, 12:14am UTC](https://community.fibery.io/t/api-error-handling-in-scripts/2062 "2021-09-28T00:14:05Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)\
**Post date:** [September 28, 2021, 12:14am UTC](https://community.fibery.io/t/api-error-handling-in-scripts/2062/1 "2021-09-28T00:14:05Z")

</div>

If I make a call to `getEntityById` (or some other API function) in a script, and it errors, will that be handled as a normal Promise rejection for the caller?

Also - in such a case, where should we look in the returned API result for the best description of the error that occurred?

---

<div class="post-metadata">

**Author:** ![Oleg](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/oleg/32/1887_2.png) [@Oleg](https://community.fibery.io/u/Oleg)\
**Post date:** [September 28, 2021, 7:36am UTC](https://community.fibery.io/t/api-error-handling-in-scripts/2062/2 "2021-09-28T07:36:18Z")

</div>

Hi, @Matt_Blais

getEntityById returns standard promise. Activity log of button/rule should contain the info about error happened in script. Please let us know if it doesn’t work for you case and we will investigate how to fix.

Thanks,  
Oleg
