Skip to content
Closed
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
8 changes: 4 additions & 4 deletions Sources/Segment/Utilities/JSON.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import Foundation


// MARK: - JSON Definition

public enum JSON: Equatable {
Expand All @@ -20,6 +19,7 @@ public enum JSON: Equatable {

private enum JSONError: Error {
case unknown
case error(message: String)
case nonJSONType(type: String)
}

Expand Down Expand Up @@ -302,7 +302,7 @@ extension JSON {
newArray.append(value)
result = try JSON(newArray)
default:
throw "This JSON object is not an array type."
throw JSONError.error(message: "This JSON object is not an array type.")
}
return result
}
Expand All @@ -325,7 +325,7 @@ extension JSON {
newObject[key] = value
result = try JSON(newObject)
default:
throw "This JSON object is not an array type."
throw JSONError.error(message: "This JSON object is not an array type.")
}
return result
}
Expand All @@ -347,7 +347,7 @@ extension JSON {
newObject.removeValue(forKey: key)
result = try JSON(newObject)
default:
throw "This JSON object is not an array type."
throw JSONError.error(message: "This JSON object is not an array type.")
}
return result

Expand Down