Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blog/add typed error handling in kotlin article #172

Merged
merged 2 commits into from
Apr 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions content/blog/2023-04-17-typed-error-handling-in-kotlin.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
title: Typed Error Handling in Kotlin
image: https://miro.medium.com/v2/resize:fit:4800/0*kOFUN-7oR7gyGXu_
category: articles
tags: [core, articles]
link: https://medium.com/@mitchellyuwono/typed-error-handling-in-kotlin-11ff25882880
---

# Typed Error Handling in Kotlin

A comparative study about several typed-error handling practices in Kotlin.

There are various approaches to error handling in the Kotlin community.
In this article we’ve explored a small subset of typed error handling practices in the community.

From the approaches explored, there were three patterns that aligns with Kotlin recommendation with
relatively low cognitive complexity including: Sealed class matching with early returns, Arrow's `either { }` builder,
and Arrow's `context(Raise<E>)` with context-receivers.

Arrow's `context(Raise<E>)` achieved the most optimized score on all aspects of
developer productivity. This includes having the lowest cognitive complexity, the lowest cyclomatic complexity
as well as the most succinct with the least lines of codes.

Read the full article: [Typed Error Handling in Koltin](https://medium.com/@mitchellyuwono/typed-error-handling-in-kotlin-11ff25882880).