Replies: 2 comments
-
Why would you want to remove it? It's an error that needs to be handled gracefully for the user. In your two functions, you have in your catch block Here's a link on how to handle errors in NodeJS Express. If you're using another backend stack, the concepts are similar. |
Beta Was this translation helpful? Give feedback.
-
@Lancernix I agree with @flipperlite comment - it's likely a sign of a problem in your code and need to be addressed as such ( adding an error handler, fixing actual error etc ). Closing the issue for now but feel free to post follow up questions here |
Beta Was this translation helpful? Give feedback.
-
When I was testing whether the select function I wrote was correct, I deliberately wrote a wrong column name. Then the console output the corresponding error, but there was an
unhandledpromiserejectionwarning
. I addedtry...catch
to all async functions, but warning still existed. It seems to bepromise.js
in mysql2 omits the handle of promise rejection? Or just there are something incorrect with my code? This warning does not affect the operation of the function, but how can I successfully remove theunhandledpromiserejectionwarning
?code:



console:
Beta Was this translation helpful? Give feedback.
All reactions