Files
divkit/client/ios/DivKit/DivReporter.swift
T
pkurchatov 27a3472171 Enabled blankLinesBetweenImports swiftformat rule
commit_hash:84ea24cbdf21ef89741080f38ec5e583172a2458
2024-12-20 12:41:02 +03:00

27 lines
726 B
Swift

import Foundation
import LayoutKit
/// The ``DivReporter`` protocol allows you to learn about actions and errors that occur in the
/// layout.
public protocol DivReporter {
func reportError(cardId: DivCardID, error: DivError)
func reportAction(cardId: DivCardID, info: DivActionInfo)
}
extension DivReporter {
public func reportAction(cardId _: DivCardID, info _: DivActionInfo) {}
func asExpressionErrorTracker(cardId: DivCardID) -> ExpressionErrorTracker {
{
reportError(
cardId: cardId,
error: DivExpressionError($0, path: UIElementPath(cardId.rawValue))
)
}
}
}
final class DefaultDivReporter: DivReporter {
func reportError(cardId _: DivCardID, error _: DivError) {}
}