_mercury
_mercury3y ago

_mercury – 20-47 Jul 20

when try {} actually work in Js?
12 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
ghardin137
ghardin1373y ago
when your code inside it throws an error?
_mercury
_mercury3y ago
js error ? or db error ?
ghardin137
ghardin1373y ago
js error
_mercury
_mercury3y ago
or pasrseInt? parseInt error?
ghardin137
ghardin1373y ago
parseInt probably won't throw an error it'll just return isNaN
_mercury
_mercury3y ago
not good Like
const groups = await pool.query(
`
select g.* from groups g
left join attribute_groups ag on g.id = ag.group_id
left join attributes a on a.id = ag.attribute_id
where a.id = ?
`,
[attribute.id]
);
const groups = await pool.query(
`
select g.* from groups g
left join attribute_groups ag on g.id = ag.group_id
left join attributes a on a.id = ag.attribute_id
where a.id = ?
`,
[attribute.id]
);
how to make this code throw an error if there is no DB success
ghardin137
ghardin1373y ago
when you say db success what do you mean?
_mercury
_mercury3y ago
I mean get valid results Actual rows not empty result [] or {}
ghardin137
ghardin1373y ago
that's not an error that's just there's nothing that matches it's a valid end state so you'd just need to check if that's the value yourself
_mercury
_mercury3y ago
Ok thx
reactibot
reactibot3y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/999417183635525773