-
-
Notifications
You must be signed in to change notification settings - Fork 625
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error Handling? #2992
Comments
Hi @kingram6865, could you provide some code context?
See the How to handle errors? FAQ section 🙋🏻♂️ |
Yeah, the FAQ does not add any new or detailed information. I included the output of error handling, which is the same as that offered in the FAQ. What kind of code context do you want? It's a simple try-catch block. try {
const [rows, fields] = await executeSQL(sql)
res.json(rows)
} catch(err) {
// console.log(Object.keys(err))
// console.log(err.name, err.message)
// throw err;
// res.json(err)
// res.send(err.message)
// for (let k in err) { console.log(`Line 34: ${k}: ${error[k]}`) }
if (err instanceof Error) {
console.log('execute error:', err);
}
} I'm preventing duplicate entries in the table at the MySQL server: IF (v_hashdupe = 0 && NEW.data IS NOT NULL) THEN
SET NEW.hash = v_hash;
ELSEIF (v_hashdupe = 0 && NEW.data IS NULL) THEN
signal sqlstate '45000' set message_text = "MISSING: No hash data";
ELSEIF (v_hashdupe > 0) THEN
signal sqlstate '45000' set message_text = "DUPLICATE: Already have that data";
END IF; |
I provided details two weeks ago. Is anyone going to respond? |
I know I don't need to explain myself, but I really like how the open-source community works. I usually create a priority queue based on how many users are affected by a bug/issue. For example a single PR (#2988) that fixes 8 issues and resolves a large discussion all at once, with practically zero code changes, also opened 2 weeks ago and no feedbacks and it's totally fine. It needs investigation, make sure nothing gets broken, etc (these things demand time and effort of the community and maintainers). At a point where the JavaScript error stack is not sufficient for your case or doesn't return a specific behavior, I don't know what should be returned. That's why we keep unanswered issues open, so any user in the community who has experienced and solved it can comment 🤝 |
Ok. Would be nice to find an answer at some point. If there is one. |
I have a REST API and for an INSERT handler I have a custom (45000) error in MySQL.
Node throws the stack in the console but I cannot capture that info in my try catch for proper handling.
There's no documentation on Error handling for mysql2. Any thoughts/suggestions?
console.log(err) produces:
The text was updated successfully, but these errors were encountered: