# Kotlin Exception Handling: Why Singleton Exceptions are a bad idea

DevFeed: [Kotlin Exception Handling: Why Singleton Exceptions are a bad idea](<https://devfeed.tech/articles/kotlin-exception-handling-why-singleton-exceptions-are-a-bad-idea-25732.md>)

Original publisher: [Read original article](<https://blog.shreyaspatil.dev/kotlin-exception-handling-why-singleton-exceptions-are-a-bad-idea/>)

Author: Shreyas Patil

Published: 2024-09-18T12:56:49Z

Content type: tutorial

Language: en

Sources: [Shreyas Patil's Blog](<https://devfeed.tech/sources/shreyas-patil-s-blog.md>)

Topics: [Exception](<https://devfeed.tech/topics/exception.md>), [Kotlin](<https://devfeed.tech/topics/kotlin.md>), [debugging](<https://devfeed.tech/topics/debugging.md>), [App](<https://devfeed.tech/topics/app.md>), [Crashlytics](<https://devfeed.tech/topics/crashlytics.md>)

Tags: [android](<https://devfeed.tech/tags/android.md>), [best-practices](<https://devfeed.tech/tags/best-practices.md>), [coding](<https://devfeed.tech/tags/coding.md>), [crashlytics](<https://devfeed.tech/tags/crashlytics.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [errors](<https://devfeed.tech/tags/errors.md>), [exception-handling](<https://devfeed.tech/tags/exception-handling.md>), [exceptionhandling](<https://devfeed.tech/tags/exceptionhandling.md>), [exceptions](<https://devfeed.tech/tags/exceptions.md>), [java](<https://devfeed.tech/tags/java.md>), [jvm](<https://devfeed.tech/tags/jvm.md>), [kotlin](<https://devfeed.tech/tags/kotlin.md>), [kotlin-beginner](<https://devfeed.tech/tags/kotlin-beginner.md>), [kotlin-multiplatform](<https://devfeed.tech/tags/kotlin-multiplatform.md>), [mistakes](<https://devfeed.tech/tags/mistakes.md>), [programming-blogs](<https://devfeed.tech/tags/programming-blogs.md>), [programming-tips](<https://devfeed.tech/tags/programming-tips.md>)

## AI overview

This Kotlin micro-blog explains why singleton exception instances can produce incorrect stack traces and mislead debugging. It recommends avoiding singleton exceptions when stack traces matter, while noting they may be acceptable for internal state or informational exceptions that are not monitored at scale.

## Source excerpt

Understand why using singleton exceptions in Kotlin can be a bad practice and how it affects stack traces and debugging in your applications.