Skip to content

Commit

Permalink
Rename RawRepresentableInitializationFailure to Error
Browse files Browse the repository at this point in the history
  • Loading branch information
Anviking committed Jan 22, 2016
1 parent 0ee5053 commit 0c91e1e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Sources/DecodingError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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))"
}
}

Expand Down
2 changes: 1 addition & 1 deletion Sources/RawRepresentableDecodable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
2 changes: 1 addition & 1 deletion Tests/RawRepresentableDecodableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 0c91e1e

Please sign in to comment.