R
Reactiflux

_mercury – 20-47 Jul 20

_mercury – 20-47 Jul 20

M_mercury7/20/2022
when try {} actually work in Js?
UUUnknown User7/20/2022
Message Not Public
Sign In & Join Server To View
Gghardin1377/20/2022
when your code inside it throws an error?
M_mercury7/20/2022
js error ? or db error ?
Gghardin1377/20/2022
js error
M_mercury7/20/2022
or pasrseInt? parseInt error?
Gghardin1377/20/2022
parseInt probably won't throw an error it'll just return isNaN
M_mercury7/20/2022
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
Gghardin1377/20/2022
when you say db success what do you mean?
M_mercury7/20/2022
I mean get valid results Actual rows not empty result [] or {}
Gghardin1377/20/2022
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
M_mercury7/20/2022
Ok thx
UUUnknown User7/21/2022
Message Not Public
Sign In & Join Server To View

Looking for more? Join the community!

R
Reactiflux

_mercury – 20-47 Jul 20

Join Server