-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gardening] Clean up do catch blocks #1627
Conversation
otaviolima
commented
Jul 11, 2018
- Remove wildcard pattern matching
- Refactor catches with empty body
- Prefer using try? to ignore errors instead of empty catch body
- Prefer not assigning a variable name
TestFoundation/TestCodable.swift
Outdated
XCTFail("\(error) for \(calendar)") | ||
} catch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the catch
not be 2 lines up?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is correct. I messed up with another change I've made while I was picking the changes to stage
before commit. Nice catch :)
Gonna fix and push again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be fine now.
0ed34fa
to
7940692
Compare
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good pending the tests passing here.
@@ -93,7 +93,7 @@ internal class _HTTPURLProtocol: _NativeProtocol { | |||
case (_, nil): | |||
set(requestBodyLength: .unknown) | |||
} | |||
} catch let e { | |||
} catch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e
is used inside the catch block for the errorCode(fileSystemError: e)
call so this should be left in
Fixed the compilation error, tests should pass now. |
7940692
to
e99ee89
Compare
@swift-ci please test |
Seems that @swift-ci did not start. |
It did, but there was another error: https://ci.swift.org/view/Pull%20Request/job/swift-corelibs-foundation-PR-Linux/1153/consoleFull |
TestFoundation/TestFileManager.swift
Outdated
XCTFail() | ||
} catch { | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks to be another issue with the catch
being moved down
- Remove wildcard pattern matching - Refactor catches with empty body - Prefer using try? to ignore errors instead of empty catch body - Prefer not assigning a variable name
e99ee89
to
019cab0
Compare
Fixed and ran tests locally, it is passing in my env. Sorry for the hassle. |
@swift-ci please test |
Looks like it passed ok: https://ci.swift.org/view/Pull%20Request/job/swift-corelibs-foundation-PR-Linux/1154/console |
@swift-ci please test and merge |