Comments (4)
Hi Mathias,
Some thoughts,
Probably the best way to really handle errors, is to fix them in alasql, the usage of throw in the src files is where the problem lies, in normal terms, the caller function should handle the error returned from a called function, not the called function bombing out with a "throw error".
So, if any function called, like delete,drop,create,detach etc has an issue, then the cb should be an object containing either a 0/1 and an error message etc.
The caller alasql function can then decide what the next action should be, in the case of core database issues, then a legitimate throw would be used, however in the case of trying to insert into a non-existent database, then an error message is more applicable
Therefore, from a Node-Red point of view, then yes a single object returned on a output is the go.
from node-red-contrib-alasql.
@Steve-Mcl Good point - and thank you for reminding me.
from node-red-contrib-alasql.
I am actually not sure.
How would be a normal way of handling this in other node-red setups? Would it be a specific message out or?
from node-red-contrib-alasql.
Hi all, regardless of error source (your node / alasql) you should try at all costs to prevent crashing node-red
The recommended method for contrib nodes in node-red is...
try {
//do stuff
} catch (e) {
node.error(e,msg);
return; //dont send a msg
}
NOTE: for promises, use the .catch mechanism to feed errors forward again using node.error(e,msg)
;
This permits the node-red catch
node to catch the error allowing the flow to handle the error appropriately.
Not handling errors in your node can crash node-red - not good.
NOTE: if you wish, you can still send a message (and include the error) but many flow developers will see a message & may not check for a msg.error
property. I have in some contrib nodes, provided a UI option to "throw errors" or "add error to msg object"
from node-red-contrib-alasql.
Related Issues (20)
- Re-implement SQL output format HOT 4
- UNION ALL problem HOT 2
- Alafile out - overwrites target file HOT 4
- Action required: Greenkeeper could not be activated 🚨
- Node crashes node-red HOT 6
- Array parameters passed via msg.payload to alasql node not working HOT 2
- node-red-contrib-alasql: JOIN DOESN'T WORK
- msg.topic doesn't work as predefined sql queries HOT 2
- msg.payload contains a object (alarms) and each alarm is a array element HOT 3
- Using Buffer HOT 1
- Update npm package HOT 6
- Could you execute "npm publish" as v2.0.0 ? HOT 2
- Access NR global context inside function
- NULL value is not returned in payload HOT 1
- "TypeError: Cannot read property 'toJS' of undefined" HOT 2
- Trying to query direct on a CSV file doesn't work if using payload as the filename HOT 1
- SELECT statement does not work properly HOT 3
- Dependency Dashboard
- Proposed feature changes HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-red-contrib-alasql.