Files
purchases-ios/Sources/Misc/FatalErrorUtil.swift
T
aboedo f5697de730 renamed Purchases folder to Sources (#1416)
* renamed `Purchases` folder to `Sources`

* temporarily enabling installation test jobs

* re-disabling installation test jobs
2022-03-28 11:53:24 -03:00

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)
}