Skip to content Skip to sidebar Skip to footer

Node Js - Promise Rejection Warning When Process A Lot Of Data

I'm creating a feature that when you pass a bar code, the product of bar code is added to a table. After that we have a button to save the data in table. For each row is necessary

Solution 1:

Your code example is 150 lines of code so I won't debug all of that (you should always provide a minimal code example needed to reproduce your problem and include in the question if you want people to help you spot and fix the actual errors) but the UnhandledPromiseRejectionWarning means that somewhere you didn't include a catch handler for a promise.

For example, if anywhere you have:

promise.then(func);

instead of:

promise.then(func1, func2);

or:

promise.then(func1).catch(func2);

Then your code is not halndling the promise rejections properly and as such is broken. In the future this program may not even start in next versions of Node - I explained it in more details in this answer:

Also, having looked at your code I strongly suggest reading about SQL injection attacks. I mean it. Google the subject and fix your code even before you fix the problem with unhandled promise rejections. Seriously. I'm not referring to this comic strip any more these years but every developer should know it and understand:

enter image description here

Please read:

Post a Comment for "Node Js - Promise Rejection Warning When Process A Lot Of Data"