# Node.warn help?

**URL:** <https://discourse.nodered.org/t/node-warn-help/45546>\
**Category:** Developing Nodes\
**Created:** [12 May 2021 13:08 UTC](https://discourse.nodered.org/t/node-warn-help/45546 "2021-05-12T13:08:27Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [12 May 2021 13:08 UTC](https://discourse.nodered.org/t/node-warn-help/45546/1 "2021-05-12T13:08:27Z")

</div>

Why doesn't this work?

`node.warn("Payload= ",msg.payload);`

In this example msg.payload is a number from 1 to 7.

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [12 May 2021 13:11 UTC](https://discourse.nodered.org/t/node-warn-help/45546/2 "2021-05-12T13:11:12Z")

</div>

> [@SteveMann](#):
>
> node.warn("Payload= ",msg.payload);

```auto
node.warn("Payload= " + msg.payload)

```

node.warn takes one parameter, you fed it two parameters

---

<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:** [12 May 2021 13:18 UTC](https://discourse.nodered.org/t/node-warn-help/45546/3 "2021-05-12T13:18:05Z")

</div>

If payload is an object, it's better to do this...

```auto
node.warn(["payload", msg.payload]);

```

Or...

```auto
node.warn({"payload": msg.payload});

```

That way, you can expand the object and inspect it.

---

<div class="post-metadata">

**Author:** ![SteveMann](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/stevemann/32/3810_2.png) [@SteveMann](https://discourse.nodered.org/u/SteveMann)\
**Post date:** [12 May 2021 19:46 UTC](https://discourse.nodered.org/t/node-warn-help/45546/4 "2021-05-12T19:46:14Z")

</div>

I can't mark two solutions, but you both nailed it for me.

I was confused because I misread my notes:  
`node.warn("variable= ", flow.variable);`

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [12 May 2021 20:04 UTC](https://discourse.nodered.org/t/node-warn-help/45546/5 "2021-05-12T20:04:04Z")

</div>

It's an easy mistake to make - as good old console.log will take , between multiple parts.

---

<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:** [12 May 2021 20:04 UTC](https://discourse.nodered.org/t/node-warn-help/45546/6 "2021-05-12T20:04:52Z")

</div>

... was just writing the exact same reply as Dave just posted, only to add... "we ought to look at making all of the log functions behave more like you'd expect.

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [12 May 2021 20:06 UTC](https://discourse.nodered.org/t/node-warn-help/45546/7 "2021-05-12T20:06:07Z")

</div>

the trickiness with that is that node.error does accept/expect a 2nd parameter...

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [26 May 2021 20:06 UTC](https://discourse.nodered.org/t/node-warn-help/45546/8 "2021-05-26T20:06:47Z")

</div>

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