From aa977b971b4baf6d905d8c1e0efbf71299fec330 Mon Sep 17 00:00:00 2001 From: loopedresolve Date: Sun, 21 Jul 2024 23:20:44 -0400 Subject: [PATCH] Make JSONRPC2Error codes public --- Sources/JSONRPC2/Public/JSONRPC2Error.swift | 6 +++--- .../{Internal => Public}/JSONRPC2ErrorCode.swift | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) rename Sources/JSONRPC2/{Internal => Public}/JSONRPC2ErrorCode.swift (53%) diff --git a/Sources/JSONRPC2/Public/JSONRPC2Error.swift b/Sources/JSONRPC2/Public/JSONRPC2Error.swift index 678fa30..636f117 100644 --- a/Sources/JSONRPC2/Public/JSONRPC2Error.swift +++ b/Sources/JSONRPC2/Public/JSONRPC2Error.swift @@ -13,9 +13,9 @@ import JSON */ public struct JSONRPC2Error: Error { - let code: Int - let message: String - let errorInfo: JSON? + public let code: Int + public let message: String + public let errorInfo: JSON? } extension JSONRPC2Error: Codable { diff --git a/Sources/JSONRPC2/Internal/JSONRPC2ErrorCode.swift b/Sources/JSONRPC2/Public/JSONRPC2ErrorCode.swift similarity index 53% rename from Sources/JSONRPC2/Internal/JSONRPC2ErrorCode.swift rename to Sources/JSONRPC2/Public/JSONRPC2ErrorCode.swift index b3491fc..23a26cb 100644 --- a/Sources/JSONRPC2/Internal/JSONRPC2ErrorCode.swift +++ b/Sources/JSONRPC2/Public/JSONRPC2ErrorCode.swift @@ -12,17 +12,17 @@ extension JSONRPC2Error { [JSON-RPC 2.0](https://www.jsonrpc.org/specification) */ - typealias Code = Int + public typealias Code = Int } extension JSONRPC2Error.Code { - static let parseError = -32700 - static let invalidRequest = -32600 - static let methodNotFound = -32601 - static let invalidParams = -32602 - static let internalError = -32603 + public static let parseError = -32700 + public static let invalidRequest = -32600 + public static let methodNotFound = -32601 + public static let invalidParams = -32602 + public static let internalError = -32603 } extension JSONRPC2Error { - static let serverError = (-32099 ... -32000) + public static let serverError = (-32099 ... -32000) }