Skip to content

Commit

Permalink
fix: print issue who create crash
Browse files Browse the repository at this point in the history
  • Loading branch information
riderx committed Apr 17, 2023
1 parent 0eac091 commit f638ef2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions ios/Plugin/CapacitorUpdater.swift
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ extension CustomError: LocalizedError {
mainError = error as NSError
}
case let .failure(error):
print("\(self.TAG) download error", response.value!, error)
print("\(self.TAG) download error", response?.value ?? "", error)
mainError = error as NSError
}
}
Expand Down Expand Up @@ -658,7 +658,7 @@ extension CustomError: LocalizedError {
setChannel.message = message
}
case let .failure(error):
print("\(self.TAG) Error set Channel", response.value!, error)
print("\(self.TAG) Error set Channel", response.value ?? "", error)
setChannel.message = "Error set Channel \(String(describing: response.value))"
setChannel.error = "response_error"
}
Expand Down Expand Up @@ -722,7 +722,7 @@ extension CustomError: LocalizedError {
case .success:
print("\(self.TAG) Stats send for \(action), version \(versionName)")
case let .failure(error):
print("\(self.TAG) Error sending stats: ", response.value!, error)
print("\(self.TAG) Error sending stats: ", response.value ?? "", error)
}
}
}
Expand Down Expand Up @@ -767,7 +767,7 @@ extension CustomError: LocalizedError {

private func saveBundleInfo(id: String, bundle: BundleInfo?) {
if bundle != nil && (bundle!.isBuiltin() || bundle!.isUnknown()) {
print("\(self.TAG) Not saving info for bundle [\(id)]", bundle!.toString())
print("\(self.TAG) Not saving info for bundle [\(id)]", bundle?.toString() ?? "")
return
}
if bundle == nil {
Expand Down
4 changes: 2 additions & 2 deletions ios/Plugin/CapacitorUpdaterPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
let sessionKey = call.getString("sessionKey", "")
let checksum = call.getString("checksum", "")
let url = URL(string: urlString)
print("\(self.implementation.TAG) Downloading \(url!)")
print("\(self.implementation.TAG) Downloading \(url ?? "")")
DispatchQueue.global(qos: .background).async {
do {
let next = try self.implementation.download(url: url!, version: version, sessionKey: sessionKey)
Expand All @@ -138,7 +138,7 @@ public class CapacitorUpdaterPlugin: CAPPlugin {
self.notifyListeners("updateAvailable", data: ["bundle": next.toJSON()])
call.resolve(next.toJSON())
} catch {
print("\(self.implementation.TAG) Failed to download from: \(url!) \(error.localizedDescription)")
print("\(self.implementation.TAG) Failed to download from: \(url ?? "") \(error.localizedDescription)")
self.notifyListeners("downloadFailed", data: ["version": version])
let current: BundleInfo = self.implementation.getCurrentBundle()
self.implementation.sendStats(action: "download_fail", versionName: current.getVersionName())
Expand Down

0 comments on commit f638ef2

Please sign in to comment.