diff --git a/Sources/DecodingError.swift b/Sources/DecodingError.swift index 63d1097..6550280 100644 --- a/Sources/DecodingError.swift +++ b/Sources/DecodingError.swift @@ -69,7 +69,7 @@ public struct MissingKeyError: DecodingError { } } -public struct RawRepresentableInitializationFailure: DecodingError { +public struct RawRepresentableInitializationError: DecodingError { public let type: Any.Type public let rawValue: Any @@ -85,7 +85,7 @@ public struct RawRepresentableInitializationFailure: DecodingError { } public var debugDescription: String { - return "RawRepresentableInitializationFailure: \(rawValue) could not be used to initialize \(type). (path: \(path))" + return "RawRepresentableInitializationError: \(rawValue) could not be used to initialize \(type). (path: \(path))" } } diff --git a/Sources/RawRepresentableDecodable.swift b/Sources/RawRepresentableDecodable.swift index c91b18b..7daf643 100644 --- a/Sources/RawRepresentableDecodable.swift +++ b/Sources/RawRepresentableDecodable.swift @@ -17,7 +17,7 @@ public extension RawRepresentable where RawValue: Decodable, Self: Decodable { static func decode(json: AnyObject) throws -> Self { let rawValue = try RawValue.decode(json) guard let rawRepresentable = Self(rawValue: rawValue) else { - throw RawRepresentableInitializationFailure(type: self, rawValue: rawValue, object: json) + throw RawRepresentableInitializationError(type: self, rawValue: rawValue, object: json) } return rawRepresentable } diff --git a/Tests/RawRepresentableDecodableTests.swift b/Tests/RawRepresentableDecodableTests.swift index 486ccc7..ea6dddb 100644 --- a/Tests/RawRepresentableDecodableTests.swift +++ b/Tests/RawRepresentableDecodableTests.swift @@ -38,7 +38,7 @@ class RawRepresentableDecodableTests: XCTestCase { do { try json => key as CMYKColor XCTFail() - } catch let error as RawRepresentableInitializationFailure { + } catch let error as RawRepresentableInitializationError { // then XCTAssertNotNil(error.object) } catch {