Dmitry Kandalov

Software Developer

Talk Title

Error handling in Kotlin: Embracing Result Types

Room

Date

TBA

Time

TBA

Share

on Twitter

Kotlin, similar to most JVM languages, has abandoned checked exceptions and instead uses a combination of runtime exceptions and nullable types. However, it's not the only option. We can do better than this by leveraging type system with a more declarative approach.

In this live coding session, you will see the transition from imperative error handling with exceptions to error handling with Result from Kotlin standard library, to Either type from Arrow library, and finally to Result4k library. Through refactoring a simple web server, we will explore the differences between the Result types and how they compare to checked exceptions. We will dive into advanced usage patterns beyond the basics, answering questions like:
- But what if I'm sure the function won't blow up?
- What if I don't have anything to do with the result?
- How do we strike a balance between exceptions and results?
- Should we just catchAll() everything?

Join us in on the journey through Result types and functional error handling in Kotlin. The lessons are likely to be useful in other languages and environments.

Speaker Bio

Dmitry has been programming since DOS times. He spent the last 15 years or so in Java lands, most recently working with server-side Kotlin.

Menu