         if CLLocationManager.locationServicesEnabled() {
             return nil
         } else {
-            return NSError(
-                domain: THGLocationErrorDomain,
-                code: THGLocationErrorCode.LocationServicesDisabled.rawValue,
-                userInfo: [NSLocalizedDescriptionKey: "Location services are not enabled."]
-            )
+            return NSError(THGLocationError.LocationServicesDisabled)
         }
     }
     

    
    :param: listener The listener to register.
    :param: request The parameters of the request.
    :returns: An optional error that could happen when registering. See `THGLocationErrorCode`.
    */
    public func registerListener(listener: AnyObject, request: LocationUpdateRequest) -> NSError? {
        return locationProvider.registerListener(listener, request: request)


let THGLocationErrorDomain: String = "THGLocationErrorDomain"

public enum THGLocationError: Int, NSErrorEnum {
    /// The user has denied access to location services or their device has been configured to restrict it.
    case AuthorizationDeniedOrRestricted
    /// The caller is asking for authorization 'always' but user has granted 'when in use'.
    case AuthorizationWhenInUse
    /// The caller is asking for authorization 'when in use' but user has granted 'always'.
    case AuthorizationAlways
    /// Location services are disabled.
    case LocationServicesDisabled
    
    public var domain: String {
        return "io.theholygrail.THGLocationError"
    }
    
    public var errorDescription: String {
        switch self {
        case .AuthorizationDeniedOrRestricted:
            return "The user has denied location services in Settings or has been restricted from using them."
        case .AuthorizationWhenInUse:
            return "The user has granted permission to location services only when the app is in use."
        case .AuthorizationAlways:
            return "The user has granted permission to location services always, so use that or change it."
        case .LocationServicesDisabled:
            return "Location services are not enabled."
        }
    }
}

/**
