Skip to content

Commit

Permalink
Also fix FirebaseFunctionsErrorCode to just be FunctionsErrorCode
Browse files Browse the repository at this point in the history
  • Loading branch information
darinf committed May 14, 2024
1 parent f03adaa commit 95fe9de
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ target_link_libraries(FirebaseFirestore PUBLIC
zlibstatic)

add_library(FirebaseFunctions SHARED
Sources/FirebaseFunctions/FirebaseFunctionsErrorCode.swift
Sources/FirebaseFunctions/FunctionsErrorCode.swift
Sources/FirebaseFunctions/Functions+Swift.swift
Sources/FirebaseFunctions/HTTPSCallable+Swift.swift
Sources/FirebaseFunctions/HTTPSCallableResult+Swift.swift)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import firebase
@_spi(FirebaseInternal)
import FirebaseCore

public struct FirebaseFunctionsErrorCode: Error {
public struct FunctionsErrorCode: Error {
public let rawValue: Int
public let localizedDescription: String

Expand All @@ -19,7 +19,7 @@ public struct FirebaseFunctionsErrorCode: Error {
}
}

extension FirebaseFunctionsErrorCode: RawRepresentable {
extension FunctionsErrorCode: RawRepresentable {
public typealias RawValue = Int

public init(rawValue: Int) {
Expand All @@ -28,7 +28,7 @@ extension FirebaseFunctionsErrorCode: RawRepresentable {
}
}

extension FirebaseFunctionsErrorCode {
extension FunctionsErrorCode {
init(_ error: firebase.functions.Error, errorMessage: String?) {
self.init((code: error.rawValue, message: errorMessage ?? "\(error.rawValue)"))
}
Expand All @@ -43,7 +43,7 @@ extension FirebaseFunctionsErrorCode {
}
}

extension FirebaseFunctionsErrorCode {
extension FunctionsErrorCode {
public static var none: Self { .init(firebase.functions.kErrorNone) }
public static var cancelled: Self { .init(firebase.functions.kErrorCancelled) }
public static var unknown: Self { .init(firebase.functions.kErrorUnknown) }
Expand All @@ -63,11 +63,11 @@ extension FirebaseFunctionsErrorCode {
public static var dataLoss: Self { .init(firebase.functions.kErrorDataLoss) }
}

extension FirebaseFunctionsErrorCode: Equatable {}
extension FunctionsErrorCode: Equatable {}

extension FirebaseFunctionsErrorCode {
extension FunctionsErrorCode {
// The Obj C API provides this type as well, so provide it here for consistency.
public typealias Code = FirebaseFunctionsErrorCode
public typealias Code = FunctionsErrorCode

// This allows us to re-expose self as a code similarly
// to what the Firebase SDK does when it creates the
Expand Down
2 changes: 1 addition & 1 deletion Sources/FirebaseFunctions/HTTPSCallable+Swift.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class HTTPSCallable {
let variant = try! toVariant(data)
let future = swift_firebase.swift_cxx_shims.firebase.functions.https_callable_call(impl, variant)
future.setCompletion({
let (result, error) = future.resultAndError { FirebaseFunctionsErrorCode($0) }
let (result, error) = future.resultAndError { FunctionsErrorCode($0) }
completion(result.map { .init($0) }, error)
})
}
Expand Down

0 comments on commit 95fe9de

Please sign in to comment.