Forwarding an error in Swift

前端 未结 2 454
北恋
北恋 2020-12-12 08:03

Is there a better solution to forward a Swift error from one function to another?

In the moment, I\'m doing it like this:

enum Error:ErrorType{

             


        
2条回答
  •  失恋的感觉
    2020-12-12 08:35

    You don't need to catch them they will be thrown automatically as you marked your function with throws

    func func1() throws {
        try func2()
    }
    

提交回复
热议问题