swiftlang/swift

[SR-978] Warn on do {} with only one empty catch {} block

開放

#43,590 建立於 2016年3月18日

 (10 則留言) (0 個反應) (0 位負責人)Swift (10,719 個分叉)batch import
compilerdiagnostics qualitydo catchgood first issueimprovementmissing warningstatementsswift 5.9

倉庫指標

星標
 (69,989 顆星)
PR 合併指標
 (PR 指標待抓取)

描述

Previous ID SR-978
Radar None
Original Reporter @jckarter
Type Improvement
Votes 0
Component/s Compiler
Labels Improvement, StarterBug
Assignee MultiColourPixel (JIRA)
Priority Medium

md5: d5f41243d2aaf067f1ecd57198c44970

Issue Description:

Eric Knapp caught some sample code in the wild unwisely using an empty catch block to swallow errors:

https://twitter.com/ejknapp/status/710589235464523776

We should warn on this to encourage people to use try! to trap on unexpected errors instead.

貢獻者指南