I am new to swift. I am learning to use do-catch. I created the following situation. When assigning a value of nil to an option, an error should be reported when forced unpacking the value of nil. Isn't do-catch used to detect runtime errors? I want to know why do catch fails to catch this error.
func canThrowAnError() throws -> Int {
let a = 1
let b = 2
var c: Int? = a + b
c = nil
let d = c!
}
do {
try canThrowAnError()
} catch {
print("catch error")
}