Skip to content

Commit 4aa4bc9

Browse files
bsneedBrandon Sneed
andauthored
Fixes compile issue w/ throws using String:Error conformance. (#90)
* Updated Sovran to remove string:error conformance. * Package resolution * Fixed throw calls that were using string:error. Co-authored-by: Brandon Sneed <[email protected]>
1 parent 89430c1 commit 4aa4bc9

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ let package = Package(
2323
.package(
2424
name: "Sovran",
2525
url: "https://github.com/segmentio/Sovran-Swift.git",
26-
from: "1.0.2"
26+
from: "1.0.3"
2727
)
2828
],
2929
targets: [

Segment.xcodeproj/project.xcworkspace/xcshareddata/swiftpm/Package.resolved

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/Segment/Utilities/JSON.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ public enum JSON: Equatable {
2121
private enum JSONError: Error {
2222
case unknown
2323
case nonJSONType(type: String)
24+
case incorrectType
2425
}
2526

2627
public init(_ object: [String: Any]) throws {
@@ -302,7 +303,7 @@ extension JSON {
302303
newArray.append(value)
303304
result = try JSON(newArray)
304305
default:
305-
throw "This JSON object is not an array type."
306+
throw JSONError.incorrectType
306307
}
307308
return result
308309
}
@@ -325,7 +326,7 @@ extension JSON {
325326
newObject[key] = value
326327
result = try JSON(newObject)
327328
default:
328-
throw "This JSON object is not an array type."
329+
throw JSONError.incorrectType
329330
}
330331
return result
331332
}
@@ -347,7 +348,7 @@ extension JSON {
347348
newObject.removeValue(forKey: key)
348349
result = try JSON(newObject)
349350
default:
350-
throw "This JSON object is not an array type."
351+
throw JSONError.incorrectType
351352
}
352353
return result
353354

0 commit comments

Comments
 (0)