Skip to content

Fixed reference to JSON in Decodable protocol method (Decodable is coding-agnostic) #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 24, 2020
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
2 changes: 1 addition & 1 deletion Half.podspec
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Pod::Spec.new do |s|

s.name = "Half"
s.version = "1.0.1"
s.version = "1.0.2"
s.summary = "Swift Half-Precision Floating Point"
s.description = <<-DESC
A lightweight framework containing a Swift implementation for a half-precision floating point type for iOS, macOS, tvOS, and watchOS.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Half/Half+Coding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ extension Half: Codable {
let float = try container.decode(Float.self)

guard float.isInfinite || float.isNaN || abs(float) <= Float(Half.greatestFiniteMagnitude) else {
throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: container.codingPath, debugDescription: "Parsed JSON number \(float) does not fit in \(type(of: self))."))
throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: container.codingPath, debugDescription: "Parsed number \(float) does not fit in \(type(of: self))."))
}

self.init(float)
Expand Down