Swallowed Error (ARCH9151)
Esta página aún no está disponible en tu idioma.
Key swift.logging.swallowed-exception · Severity error · Category logging
Flags try? whose result is discarded, and catch blocks that return nil/default without logging. try? await Task.sleep(...) is the sleep-unless-cancelled idiom and is excepted.
Incorrect
Section titled “Incorrect”try? cache.write(item)_ = try? sync()Correct
Section titled “Correct”do { try cache.write(item) } catch { logger.warning("cache write failed: \(error)") }Handle or log the error; try? is for cases where the failure genuinely does not matter.