---
title: "Stop throwing exceptions!"
url: https://daily.dev/posts/stop-throwing-exceptions--tjrssfzj0
source_url: https://proandroiddev.com/stop-throwing-exceptions-4282c8472027
type: article
source: "ProAndroidDev"
published: 2024-07-31T01:55:33.343Z
updated: 2024-10-05T16:32:56.106Z
tags: ["android", "kotlin", "functional-programming"]
reading_time: 12
upvotes: 52
comments: 7
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Stop throwing exceptions!

**[ProAndroidDev](https://daily.dev/sources/pand)** · 12 min read · 52 upvotes · 7 comments

## Summary

In Kotlin, it's recommended to avoid throwing exceptions and instead handle error scenarios using try/catch expressions, result objects, and functional programming paradigms. The default usage of try/catch is criticized for reducing readability and maintainability. The post suggests Kotlin's built-in Result class for better error handling, providing examples of how to wrap operations in Result objects and handle errors more effectively. This approach promotes cleaner, more testable code without relying on exceptions.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://proandroiddev.com/stop-throwing-exceptions-4282c8472027>

## Community discussion

Top comments from developers on daily.dev.

**@joashua** · 14 upvotes

> Nah, continue throwing Exceptions, it’s great.

**@marcobreveglieri** · 7 upvotes

> AFAIK one of the reasons exceptions have been created is to overcome the cumbersome "if (success)" pattern, and they are widely used also in "non error" scenarios when some condition occurs preventing the following code to go on with its work.
>
> I don't find the suggested approach an ideal way to handle exceptions, replacing them with the good old "result code", nor the tip to wrap all the methods that potentially throw exceptions into "catch adapters" feels like a good solution (you will find yourself with tons and tons of  these methods).
>
> Sorry but I think I'll stick with exceptions. :-)

**@ccidral** · 0 upvotes

> Yeah some devs are on one end of the spectrum, i.e. they abuse exceptions, but please don't shift to the other extreme by never throwing exceptions when it makes sense to throw them. Exceptions have their place.

**@sdev** · 0 upvotes

> I also think that exceptions is the way (cf. comment above).
>
> Nevertheless, this post makes me think that the author has a point. Somehow, throwed exceptions could appear in typing and make things clearer, yet probably too verbose.

**@fabooy961** · 0 upvotes

> what a shit!

## Similar posts on daily.dev

- [Don’t just attend KubeCon \+ CloudNativeCon, Merge Forward your experience\!](https://daily.dev/posts/don-t-just-attend-kubecon-cloudnativecon-merge-forward-your-experience--l0rpp73x8) · CNCF · 0 upvotes · 0 comments
- [Announcing H2 2026 KCDs](https://daily.dev/posts/announcing-h2-2026-kcds-m96goajm1) · CNCF · 1 upvotes · 0 comments
- [Two months of Open Community Groups](https://daily.dev/posts/two-months-of-open-community-groups-asf52zhbs) · CNCF · 0 upvotes · 0 comments
- [CNCF Unveils Schedule for KubeCon \+ CloudNativeCon Europe 2026](https://daily.dev/posts/cncf-unveils-schedule-for-kubecon-cloudnativecon-europe-2026-ikhcoa5cb) · CNCF · 2 upvotes · 0 comments
- [CNCF Debuts KubeCon \+ CloudNativeCon Japan 2026 Schedule](https://daily.dev/posts/cncf-debuts-kubecon-cloudnativecon-japan-2026-schedule-xp5pyudub) · CNCF · 1 upvotes · 0 comments

---

Tags: [#android](https://daily.dev/tags/android), [#kotlin](https://daily.dev/tags/kotlin), [#functional-programming](https://daily.dev/tags/functional-programming)

[View this post on daily.dev](https://daily.dev/posts/stop-throwing-exceptions--tjrssfzj0)
