Flinging poo in Swift

Thanks to one of the genuine upsides of Swift, full Unicode support in the compiler itself, you can do:

enum EmojiErrors: Error {
    case ๐Ÿ’ฉ

let ๐Ÿ’ฉ = EmojiErrors.๐Ÿ’ฉ

Finally you can express yourself honestly within your program:


Or, if you prefer to be polite & British about it:

func flinging<E: Error>(_ error: E) throws -> Never {

try flinging(๐Ÿ’ฉ)

You can go further, if you like, and have all manner of interesting things thrown about your program:

enum EmojiErrors: Error {
    case ๐Ÿ’ฉ
    case ๐Ÿ–•
    case ๐Ÿž
    case ๐ŸŽฎ
    case ๐Ÿˆ
    case ๐Ÿ’ฃ
    case ๐Ÿ“ฑ
    case ๐Ÿ’ป
    case ๐Ÿ–ฅ
    case ๐ŸŽ‰

Leave a Reply