mirror of
https://github.com/RevenueCat/purchases-ios
synced 2026-11-10 22:45:55 +05:45
* renamed `Purchases` folder to `Sources` * temporarily enabling installation test jobs * re-disabling installation test jobs
34 lines
1011 B
Swift
34 lines
1011 B
Swift
//
|
|
// Copyright RevenueCat Inc. All Rights Reserved.
|
|
//
|
|
// Licensed under the MIT License (the "License");
|
|
// you may not use this file except in compliance with the License.
|
|
// You may obtain a copy of the License at
|
|
//
|
|
// https://opensource.org/licenses/MIT
|
|
//
|
|
// FatalErrorUtil.swift
|
|
//
|
|
// Created by Andrés Boedo on 9/16/21.
|
|
|
|
import Foundation
|
|
|
|
enum FatalErrorUtil {
|
|
|
|
fileprivate static var fatalErrorClosure: (String, StaticString, UInt) -> Never = defaultFatalErrorClosure
|
|
|
|
private static let defaultFatalErrorClosure = { Swift.fatalError($0, file: $1, line: $2) }
|
|
|
|
static func replaceFatalError(closure: @escaping (String, StaticString, UInt) -> Never) {
|
|
fatalErrorClosure = closure
|
|
}
|
|
|
|
static func restoreFatalError() {
|
|
fatalErrorClosure = defaultFatalErrorClosure
|
|
}
|
|
}
|
|
|
|
func fatalError(_ message: @autoclosure () -> String = "", file: StaticString = #fileID, line: UInt = #line) -> Never {
|
|
FatalErrorUtil.fatalErrorClosure(message(), file, line)
|
|
}
|