Instance Methodswift-package-manager 6.0.3Basics
trap(_:)
trap a throwing closure, emitting diagnostics on error and returning boolean representing success
@discardableResult func trap(_ closure: () throws -> Void) -> Bool
trap a throwing closure, emitting diagnostics on error and returning boolean representing success
@discardableResult func trap(_ closure: () throws -> Void) -> Bool
import Basics
protocol DiagnosticsEmitterProtocol
typealias Void = ()
The return type of functions that don’t explicitly specify a return type, that is, an empty tuple ()
.
@frozen struct Bool
A value type whose instances are either true
or false
.
func emit(_ diagnostics: [Diagnostic])
func emit(_ error: Error, metadata: ObservabilityMetadata? = .none)
func emit(debug message: String, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(debug message: CustomStringConvertible, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(error message: String, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(error message: CustomStringConvertible, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(info message: String, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(info message: CustomStringConvertible, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(severity: Diagnostic.Severity, message: String, metadata: ObservabilityMetadata? = .none)
func emit(warning message: String, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func emit(warning message: CustomStringConvertible, metadata: ObservabilityMetadata? = .none, underlyingError: Error? = .none)
func trap<T>(_ closure: () throws -> T) -> T?
trap a throwing closure, emitting diagnostics on error and returning the value returned by the closure