# Struct vs Enum for Error Types

**URL:** <https://forums.swift.org/t/struct-vs-enum-for-error-types/78303>\
**Category:** Using Swift\
**Created:** [March 5, 2025, 5:03pm UTC](https://forums.swift.org/t/struct-vs-enum-for-error-types/78303 "2025-03-05T17:03:27Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![allevato](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/allevato/32/385_2.png) [@allevato](https://forums.swift.org/u/allevato)\
**Post date:** [March 5, 2025, 5:45pm UTC](https://forums.swift.org/t/struct-vs-enum-for-error-types/78303/3 "2025-03-05T17:45:52Z")

</div>

One big disadvantage to using enums for errors is that if you're developing standard built-from-source packages (i.e., not using library evolution and distributing something as a prebuilt library), adding a new `case` to the `enum` is a source-breaking change for your clients because they could theoretically be switching exhaustively over them. So instead, you have to introduce new separate `enum`s to represent new failure modes in the future. This limitation is one of the motivations behind pitches like [this one](https://forums.swift.org/t/pitch-extensible-enums-for-non-resilient-modules/77649).

---

_[View the full topic](https://forums.swift.org/t/struct-vs-enum-for-error-types/78303)._
