新版本的变更 / Swift 6.0

// *** in version 6.0: ***
enum LoadErrorError {
    case notFound, denied
}

//the thrown type is now a part
//of the signature
func load(_ name: Stringthrows(LoadError) {
    throw .notFound
}

do {
    try load("data.txt")
catch {
    //error is LoadError, not any Error
    print("error is \(error)")
}
//error is notFound