Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am arashbina on github.
  • I am arash (https://keybase.io/arash) on keybase.
  • I have a public key ASDTY3FsEvdYSrYyMah_bRwakDpYVBqbBGntM7Xnphn_hwo

To claim this, I am signing this object:

@arashbina
arashbina / ErrorHandler.swift
Last active August 29, 2015 14:21
A simple error handling class in Swift. It allows for creation of NSError objects with use of defined errors in the form of enums.
// A simple error handling class in Swift. It allows for creation of NSError objects with use of defined errors in the form of enums.
// For example you can create an NSError like this: let error = Error(SessionError.NotConnected)
import Foundation
// We want all enums to have a domain.
// RawRepresentable is required for accessing rawValue on enums.
public protocol ErrorConformable: RawRepresentable {
var domain: String {get}
}