Skip to content

Commit

Permalink
Improve error logging
Browse files Browse the repository at this point in the history
  • Loading branch information
prof18 committed Jul 21, 2024
1 parent f1398eb commit 37f1285
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions iosApp/Source/Accounts/Dropbox/Data/DropboxDataSourceIos.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class DropboxDataSourceIos: DropboxDataSource {
switch result {
case .success(let requestBox):
return requestBox
case .failure(let error):
case .failure:
return nil
}
}
Expand Down Expand Up @@ -103,10 +103,21 @@ class DropboxDataSourceIos: DropboxDataSource {
completionHandler(downloadResult, nil)

} else if let error = error {
print(error)
KotlinDependencies.shared.getLogger(tag: "DropboxDataSourceIos").e(
messageString: error.localizedDescription
messageString: error.description
)

switch error as CallError {
case .routeError(let boxed, _, _, _):
let err = boxed.unboxed as Files.DownloadError
KotlinDependencies.shared.getLogger(tag: "DropboxDataSourceIos").e(
messageString: "Boxed error: \(err.description)"
)

default:
break
}

completionHandler(nil, DropboxErrors.downloadError(reason: error.description))
}
}
Expand Down Expand Up @@ -142,7 +153,7 @@ class DropboxDataSourceIos: DropboxDataSource {
)

switch error as CallError {
case .routeError(let boxed, let userMessage, let errorSummary, let requestId):
case .routeError(let boxed, _, _, _):
let err = boxed.unboxed as Files.UploadError
KotlinDependencies.shared.getLogger(tag: "DropboxDataSourceIos").e(
messageString: "Boxed error: \(err.description)"
Expand Down Expand Up @@ -203,6 +214,6 @@ class DropboxDataSourceIos: DropboxDataSource {
}

private func createClient() -> DropboxClient? {
DropboxClientsManager.authorizedClient
DropboxClientsManager.authorizedClient ?? DropboxClientsManager.authorizedBackgroundClient
}
}

0 comments on commit 37f1285

Please sign in to comment.