Comment

Comment by symbol-mason

The general answer is "represent it in the type system". That's typically via discriminated unions like Rust's Result, or something which emulates it (such as OneOf or Dunet for C#, although it will be a native part of the language soon).

Pattern matching, nullable types, and the Try* method conventions are also ways of representing the potential for failure explicitly.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton