Skip to content
This repository has been archived by the owner on May 17, 2024. It is now read-only.

Remove deprecated MapperError initializer #53

Merged
merged 1 commit into from
May 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
- Allow transformations to throw when the field is missing
[Keith Smiley](https://github.com/keith)
[#52](https://github.com/lyft/mapper/pull/52)
- Remove the `MapperError` initializer
[Keith Smiley](https://github.com/keith)
[#53](https://github.com/lyft/mapper/pull/53)

## Enhancements

Expand Down
6 changes: 0 additions & 6 deletions Sources/MapperError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,4 @@ public enum MapperError: ErrorType {
case InvalidRawValueError(field: String, value: Any, type: Any.Type)
case MissingFieldError(field: String)
case TypeMismatchError(field: String, value: AnyObject, type: Any.Type)

@available(*, deprecated, message="MapperError initializer is deprecated. Use an enum case directly.")
@warn_unused_result
public init() {
self = .CustomError(field: nil, message: "Legacy MapperError initializer")
}
}
13 changes: 0 additions & 13 deletions Tests/Mapper/ErrorTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,4 @@ final class ErrorTests: XCTestCase {
XCTFail()
}
}

func testDeprecatedInitializer() {
do {
let map = Mapper(JSON: ["string": 1])
_ = try map.from("string", transformation: { _ in throw MapperError() })
XCTFail()
} catch MapperError.CustomError(let field, let message) {
XCTAssertNil(field)
XCTAssertFalse(message.isEmpty)
} catch {
XCTFail()
}
}
}