Skip to content

Commit

Permalink
💫 Update: Make RNIError Public
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed May 10, 2023
1 parent c9aaacc commit f583258
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
18 changes: 10 additions & 8 deletions ios/src_library/React Native/RNIError/RNIError.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,18 @@

import Foundation

/// TODO - Move to `react-native-ios-utilities`
/// * Replace older impl. of `RNIError` with this version

internal class RNIBaseError<E: RawRepresentable>: Error where E.RawValue == String {
public class RNIBaseError<E: RawRepresentable>: 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,
Expand All @@ -28,7 +30,7 @@ internal class RNIBaseError<E: RawRepresentable>: 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),
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation


internal class RNIGenericError: RNIBaseError<RNIGenericErrorCode> {
public class RNIGenericError: RNIBaseError<RNIGenericErrorCode> {

init(
code: RNIGenericErrorCode,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import Foundation


internal enum RNIGenericErrorCode:
public enum RNIGenericErrorCode:
String, Codable, CaseIterable, RNIGenericErrorDefaultable {

case runtimeError, libraryError, reactError, unknownError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down

0 comments on commit f583258

Please sign in to comment.