Based on the Algebraic-data type, we can define a type that represents either success with a value or failure with a reason. It's often called
Result. In Rust, this is a standard way to handle the error. In Kotlin and TypeScript, the languages provide an exception mechanism as the common way to handle the error, and there are third-party libraries that provide the
Result type. In this article, I explain my understanding of error in programming and my ideal way to handle error.