Skip to content

Commit 21946a0

Browse files
fix: non faliure version checking with try?
1 parent 6c1422f commit 21946a0

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Sources/Swiftly/Swiftly.swift

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,22 @@ extension SwiftlyCommand {
108108
// Verify that the configuration exists and can be loaded
109109
_ = try await Config.load(ctx)
110110

111-
let swiftlyRelease = try await ctx.httpClient.getCurrentSwiftlyRelease()
112-
let shouldUpdateSwiftly = try swiftlyRelease.swiftlyVersion > SwiftlyCore.version
113-
114111
return {
115-
if shouldUpdateSwiftly {
112+
if let swiftlyRelease = try? await ctx.httpClient.getCurrentSwiftlyRelease(),
113+
swiftlyRelease.swiftlyVersion > SwiftlyCore.version
114+
{
116115
let updateMessage = """
117116
-----------------------------
118117
A new release of swiftly is available.
119118
Please run `swiftly self-update` to update.
120119
-----------------------------\n
121120
"""
122-
121+
123122
if let data = updateMessage.data(using: .utf8) {
124123
FileHandle.standardError.write(data)
125124
}
126125
}
127126
}
127+
128128
}
129129
}

0 commit comments

Comments
 (0)