mas/mas-cli/Error.swift

45 lines
908 B
Swift
Raw Normal View History

//
// Error.swift
// mas-cli
//
// Created by Andrew Naylor on 21/08/2015.
// Copyright (c) 2015 Andrew Naylor. All rights reserved.
//
public let MASErrorDomain: String = "MASErrorDomain"
private let MASErrorSource: String = "MASErrorSource"
public enum MASErrorCode: Int {
2016-09-17 12:58:38 +00:00
case noError
case notSignedIn
case purchaseError
case noDownloads
case cancelled
case downloadFailed
case signInError
case alreadySignedIn
case searchError
case noSearchResultsFound
case noUpdatesFound
var exitCode: Int32 {
return Int32(self.rawValue)
}
}
2016-09-17 15:33:50 +00:00
open class MASError: Error {
2016-09-17 12:58:38 +00:00
let code: MASErrorCode
2016-09-17 12:58:38 +00:00
let sourceError: NSError?
2016-09-17 12:58:38 +00:00
init(code: MASErrorCode, sourceError: NSError? = nil) {
self.code = code
self.sourceError = sourceError
}
}
public func == (lhs: MASError, rhs: MASError) -> Bool {
return false
2016-09-17 12:58:38 +00:00
}