Skip to content

Change `RedisClientError` from enum to struct

Nathan Harris requested to merge error-as-struct into master

Motivation:

The current state of Swift does not leave room for library evolution of enum types used for Error.

To avoid having to increment Major SemVer to add a new error case that might be needed to fix a bug, the enum-like struct idiom should be used.

Ideally this idiom will disappear, when Swift provides a way for Swift Packages to have a "library evolution" capability.

See https://forums.swift.org/t/extensible-enumerations-for-non-resilient-libraries/35900

Modifications:

  • Change: RedisClientError to be struct with private enum value

Result:

Should new error cases be necessary to add, they can be in Minor SemVer releases, rather than Major SemVer.

Merge request reports