Skip to content

Instantly share code, notes, and snippets.

@erica erica/errors.swift
Last active Aug 29, 2015

Embed
What would you like to do?
Value representation errors when using enums with multiple associated values
// When using an enumeration with multiple cases
// and associated values the details related to
// the case and the associated value disappear
//
// Remove one case and the issue goes away.
//
public enum FaintingCouch : ErrorType {
case ClutchPearls(String)
// case GaspLoudly(String) // uncomment this to see problem
}
func foo() throws {
throw FaintingCouch.ClutchPearls("Test")
}
do {
try foo()
} catch {print(error)} // Prints FaintingCouch but no futher info
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.