示例工程 13-error-handling

13-error-handling/Diagnostics/ThrowNonError.swift

swift · 0.2 KB

// 故意编译失败:抛出的类型必须遵循 Error。
// 复现:swiftc Diagnostics/ThrowNonError.swift
func boom() throws {
    throw "boom"
}
 
try boom()