# Systems Variable for functionName?

**URL:** <https://discourse.nodered.org/t/systems-variable-for-functionname/13551>\
**Category:** General\
**Created:** [22 July 2019 15:28 UTC](https://discourse.nodered.org/t/systems-variable-for-functionname/13551 "2019-07-22T15:28:15Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)\
**Post date:** [22 July 2019 15:28 UTC](https://discourse.nodered.org/t/systems-variable-for-functionname/13551/1 "2019-07-22T15:28:15Z")

</div>

Is there a systems variable with which to read the function name from which it was called? (in a function).. ?

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [22 July 2019 16:15 UTC](https://discourse.nodered.org/t/systems-variable-for-functionname/13551/2 "2019-07-22T16:15:48Z")

</div>

I think that you need to explain more about what you are trying to achieve.

---

<div class="post-metadata">

**Author:** ![IoTPlay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/iotplay/32/40_2.png) [@IoTPlay](https://discourse.nodered.org/u/IoTPlay)\
**Post date:** [22 July 2019 16:28 UTC](https://discourse.nodered.org/t/systems-variable-for-functionname/13551/3 "2019-07-22T16:28:54Z")

</div>

Ahhh, sorry,

want to create error trapping - want to send errors to a database, with some fields, like what was the incoming topic, messafge, error code, and from which function it came, want to sue same code in multiple functions, thus want a systems variable in the error trapping code that includes the function name it came from.

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [22 July 2019 17:23 UTC](https://discourse.nodered.org/t/systems-variable-for-functionname/13551/4 "2019-07-22T17:23:51Z")

</div>

The catch node can give you some details in `msg.error` object.

I do this for logging to file by extracting what I need from the error object.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [22 July 2019 17:24 UTC](https://discourse.nodered.org/t/systems-variable-for-functionname/13551/5 "2019-07-22T17:24:25Z")

</div>

Have a look at the docs that tell what variables are defined in the Function node: [https://nodered.org/docs/user-guide/writing-functions#api-reference](https://nodered.org/docs/user-guide/writing-functions#api-reference)
