0001 // 0002 // PropertyLoaderError.swift 0003 // Swinject 0004 // 0005 // Created by mike.owens on 12/8/15. 0006 // Copyright © 2015 Swinject Contributors. All rights reserved. 0007 // 0008 0009 import Foundation 0010 0011 0012 /// Represents errors that can be thrown when loading properties into a container 0013 /// 0014 /// - InvalidJSONFormat: The JSON format of the properties file is incorrect. Must be top-level dictionary 0015 /// - InvalidPlistFormat: The Plist format of the properties file is incorrect. Must be top-level dictionary 0016 /// - MissingResource: The resource is missing from the bundle 0017 /// - InvalidResourceDataFormat: The resource cannot be converted to NSData 0018 /// 0019 public enum PropertyLoaderError: ErrorType { 0020 case InvalidJSONFormat
JsonPropertyLoader.swift:75 throw PropertyLoaderError.InvalidJSONFormat(bundle: bundle, name: name)PlistPropertyLoader.swift:40 throw PropertyLoaderError.InvalidPlistFormat(bundle: bundle, name: name)PropertyLoaderError.swift:27 extension PropertyLoaderError: CustomStringConvertible {PropertyLoaderType.swift:36 throw PropertyLoaderError.MissingResource(bundle: bundle, name: name)PropertyLoaderType.swift:53 throw PropertyLoaderError.InvalidResourceDataFormat(bundle: bundle, name: name)PropertyLoaderType.swift:55 throw PropertyLoaderError.MissingResource(bundle: bundle, name: name)(bundle: NSBundle, name: String) 0021 case InvalidPlistFormat
JsonPropertyLoader.swift:75 throw PropertyLoaderError.InvalidJSONFormat(bundle: bundle, name: name)PropertyLoaderError.swift:30 case .InvalidJSONFormat(let bundle, let name):(bundle: NSBundle, name: String) 0022 case MissingResource
PlistPropertyLoader.swift:40 throw PropertyLoaderError.InvalidPlistFormat(bundle: bundle, name: name)PropertyLoaderError.swift:32 case .InvalidPlistFormat(let bundle, let name):(bundle: NSBundle, name: String) 0023 case InvalidResourceDataFormat
PropertyLoaderError.swift:34 case .MissingResource(let bundle, let name):PropertyLoaderType.swift:36 throw PropertyLoaderError.MissingResource(bundle: bundle, name: name)PropertyLoaderType.swift:55 throw PropertyLoaderError.MissingResource(bundle: bundle, name: name)(bundle: NSBundle, name: String) 0024 } 0025 0026 // MARK: - CustomStringConvertible 0027 extension PropertyLoaderError: CustomStringConvertible { 0028 public var description: String { 0029 switch self { 0030 case .InvalidJSONFormat(let bundle, let name): 0031 return "Invalid JSON format for bundle: \(bundle), name: \(name). Must be top-level dictionary" 0032 case .InvalidPlistFormat(let bundle, let name): 0033 return "Invalid Plist format for bundle: \(bundle), name: \(name). Must be top-level dictionary" 0034 case .MissingResource(let bundle, let name): 0035 return "Missing resource for bundle: \(bundle), name: \(name)" 0036 case .InvalidResourceDataFormat(let bundle, let name): 0037 return "Invalid resource format for bundle: \(bundle), name: \(name)" 0038 } 0039 } 0040 } 0041
PropertyLoaderError.swift:36 case .InvalidResourceDataFormat(let bundle, let name):PropertyLoaderType.swift:53 throw PropertyLoaderError.InvalidResourceDataFormat(bundle: bundle, name: name)