node-red-nodes
node-red-nodes copied to clipboard
I need error msg
I still need the msg.payload when there is an error, not only when everything is going well.
- [ ] Bugfix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
Proposed changes
Checklist
- [ ] I have read the contribution guidelines
- [ ] For non-bugfix PRs, I have discussed this change on the forum/slack team.
- [ ] I have run
grunt
to verify the unit tests pass - [ ] I have added suitable unit tests to cover the new/changed functionality
- :x: - login: @tamasvar . The commit (b9701db57863ff3062190428745748e708a6120b, 1860182420807a4d09014cf238f6d8eeb01146b2) is not authorized under a signed CLA. Please click here to be authorized. For further assistance with EasyCLA, please submit a support request ticket.
I can understand why you may want it - but for naive users I think it is better to not send anything when there is an error, rather than send a (normally) empty [] response that would look like a valid response unless you check for an error. So I'm not (yet) convinced that this a change we should make. You could also use the error to create a dummy payload [] if you need to forward it on - but yes your fix would do that for you.
I can understand why you may want it - but for naive users I think it is better to not send anything when there is an error, rather than send a (normally) empty [] response that would look like a valid response unless you check for an error. So I'm not (yet) convinced that this a change we should make. You could also use the error to create a dummy payload [] if you need to forward it on - but yes your fix would do that for you.
I agree that it shouldn't send an error but I do think it should throw an error
I would suggest a slightly different approach - with largely the same result.
Create a secondary output, which is used in case of error.
In 64-mysql.html change:
outputs:1,
to
outputs:2,
In 68-mysql.js
After the line (147)
node.error(err, msg);
add line:
send([null, { query: msg.topic, payload: 'ERROR', error: err }]);
You could event remove the node.error() - if you wanted it to be less chatty
I created a PR: https://github.com/node-red/node-red-nodes/pull/1062