Skip to content

Swallowed Error (ARCH9151)

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.

try? cache.write(item)
_ = try? sync()
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.