Files
JSONAPI/Sources/JSONAPI/Document/Error.swift
T
2018-11-27 09:11:13 -08:00

28 lines
533 B
Swift

//
// Error.swift
// JSONAPI
//
// Created by Mathew Polzin on 11/10/18.
//
public protocol JSONAPIError: Swift.Error, Equatable, Codable {
static var unknown: Self { get }
}
public enum UnknownJSONAPIError: JSONAPIError {
case unknownError
public init(from decoder: Decoder) throws {
self = .unknown
}
public func encode(to encoder: Encoder) throws {
var container = encoder.singleValueContainer()
try container.encode("unknown")
}
public static var unknown: UnknownJSONAPIError {
return .unknownError
}
}