From f58325808f9a94d49d2b57f8c5714d961cb52e9c Mon Sep 17 00:00:00 2001 From: Dominic Go <18517029+dominicstop@users.noreply.github.com> Date: Wed, 10 May 2023 16:29:47 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AB=20Update:=20Make=20`RNIError`=20Pu?= =?UTF-8?q?blic?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../React Native/RNIError/RNIError.swift | 18 ++++++++++-------- .../RNIError/RNIGenericError.swift | 2 +- .../RNIError/RNIGenericErrorCode.swift | 2 +- .../RNIError/RNIGenericErrorDefaultable.swift | 2 +- 4 files changed, 13 insertions(+), 11 deletions(-) diff --git a/ios/src_library/React Native/RNIError/RNIError.swift b/ios/src_library/React Native/RNIError/RNIError.swift index e19d76df..abd35d2e 100644 --- a/ios/src_library/React Native/RNIError/RNIError.swift +++ b/ios/src_library/React Native/RNIError/RNIError.swift @@ -7,16 +7,18 @@ import Foundation +/// TODO - Move to `react-native-ios-utilities` +/// * Replace older impl. of `RNIError` with this version -internal class RNIBaseError: Error where E.RawValue == String { +public class RNIBaseError: Error where E.RawValue == String { - internal var code: E; - internal let domain: String; + public var code: E; + public let domain: String; - internal let message: String?; - internal let debug: String?; + public let message: String?; + public let debug: String?; - internal init( + public init( code: E, domain: String, message: String? = nil, @@ -28,7 +30,7 @@ internal class RNIBaseError: Error where E.RawValue == Stri self.debug = debug; }; - internal func createJSONString() -> String? { + public func createJSONString() -> String? { let encoder = JSONEncoder(); guard let data = try? encoder.encode(self), @@ -48,7 +50,7 @@ extension RNIBaseError: Encodable { case code, domain, message, debug; }; - internal func encode(to encoder: Encoder) throws { + public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self); try container.encode(self.code.rawValue, forKey: .code); diff --git a/ios/src_library/React Native/RNIError/RNIGenericError.swift b/ios/src_library/React Native/RNIError/RNIGenericError.swift index 40e661c0..af4895f3 100644 --- a/ios/src_library/React Native/RNIError/RNIGenericError.swift +++ b/ios/src_library/React Native/RNIError/RNIGenericError.swift @@ -8,7 +8,7 @@ import Foundation -internal class RNIGenericError: RNIBaseError { +public class RNIGenericError: RNIBaseError { init( code: RNIGenericErrorCode, diff --git a/ios/src_library/React Native/RNIError/RNIGenericErrorCode.swift b/ios/src_library/React Native/RNIError/RNIGenericErrorCode.swift index 8e49c0a7..428cbc52 100644 --- a/ios/src_library/React Native/RNIError/RNIGenericErrorCode.swift +++ b/ios/src_library/React Native/RNIError/RNIGenericErrorCode.swift @@ -8,7 +8,7 @@ import Foundation -internal enum RNIGenericErrorCode: +public enum RNIGenericErrorCode: String, Codable, CaseIterable, RNIGenericErrorDefaultable { case runtimeError, libraryError, reactError, unknownError, diff --git a/ios/src_library/React Native/RNIError/RNIGenericErrorDefaultable.swift b/ios/src_library/React Native/RNIError/RNIGenericErrorDefaultable.swift index dd2e04b7..4c684e1a 100644 --- a/ios/src_library/React Native/RNIError/RNIGenericErrorDefaultable.swift +++ b/ios/src_library/React Native/RNIError/RNIGenericErrorDefaultable.swift @@ -8,7 +8,7 @@ import Foundation -internal protocol RNIGenericErrorDefaultable { +public protocol RNIGenericErrorDefaultable { static var runtimeError : Self { get }; static var libraryError : Self { get }; static var reactError : Self { get };