News for hackers. Stuff that matters.
Re:Ask HN: What is the “proper” way to do error-handling in ... by raydiatian on Tuesday January 24, 2023 @12:52PM (#34507226)
I have already considered using Errors in return type unions, that is

    function getIntOrFailMiserably(): number | Error {
      ..
    }
Is that really the best there is? Obviously, I can't control OPC (other people's code. you down with OPC? yeah you know me) with this, unless I wrap it and search like a hawk for the error.
Re:Ask HN: What is the “proper” way to do error-handling in ... by TechBro8615 on Tuesday January 24, 2023 @01:09PM (#34507465)
You might like fp-ts and its Result type.