问题
I want to set Swift error breakpoint to handle Swift Error of ErrorType in swift. But i am not getting What to set as Type value in BreakPoint ?
回答1:
If you just create a Swift error breakpoint, it breaks on anything that conforms to ErrorType.
If you put something in Type, it'll only break when that type is thrown.
In the following:
enum MyError: ErrorType
{
case AnError
}
enum MyOtherError: ErrorType
{
case AnotherError
}
public func throwAnError()
{
do
{
throw MyOtherError.AnotherError
}
catch
{
print("Caught 1")
}
do
{
throw MyError.AnError
}
catch
{
print("Caught 2")
}
}
A break on Swift error will cause the debugger to stop on both throw lines. If you put MyError in the type field, the debugger will only stop on the second throw line.
来源:https://stackoverflow.com/questions/34436629/how-to-edit-swift-error-breakpoint