Kotlin Error Handling - Exceptions to Nulls

Опубликовано: 06 Октябрь 2024
на канале: Pairing with Duncan
720
25

Part 25 of an exploration of where a Test Driven Development implementation of the Gilded Rose stock control system might take us in Kotlin. You can see the whole series as a playlist    • All Gilded Rose Episodes   and the code on GitHub https://github.com/dmcg/gilded-rose-tdd

Over the next few episodes we'll look at the important topic of error handling. Kotlin has exceptions, but not checked exceptions, so there is no way to force the caller of a function to consider whether (or what) it can throw. We can signal that code can fail by returning null though, as we will see here.
I'll collect the other episodes in a playlist -    • Kotlin Error Handling - Exceptions, N...  

If you like this, you’ll probably like the book Java to Kotlin, A Refactoring Guidebook http://java-to-kotlin.dev. Chapter 19 covers error handling.