Re:Ask HN: What is the “proper” way to do error-handling in ...
by shams93 on Tuesday January 24, 2023 @12:57PM
(#34507305)
catch (e) {
const error = e as <Your custom error type>;
}
[ Parent
| on HN ]
Re:Ask HN: What is the “proper” way to do error-handling in ...
by raydiatian on Tuesday January 24, 2023 @01:06PM
(#34507423)
On an aside, how do you feel about this? Typescript was supposed to bring type visibility to JavaScript. But this still feels like bring your own research. If you input the wrong <Your custom error type>, TS compiler won’t prompt you. This makes me sad.