Improve logging

sync2
Laurent 1 year ago
parent 214420f98a
commit 1ef5725029
  1. 12
      LeStorage/ApiCallCollection.swift

@ -253,7 +253,7 @@ actor ApiCallCollection<T: Storable>: SomeCallCollection {
return try await self._synchronize(instance, method: HTTPMethod.post)
} catch {
self.rescheduleApiCallsIfNecessary()
StoreCenter.main.log(message: "POST failed for \(instance)")
StoreCenter.main.log(message: "POST failed for \(instance): \(error.localizedDescription)")
Logger.error(error)
}
return nil
@ -266,7 +266,7 @@ actor ApiCallCollection<T: Storable>: SomeCallCollection {
return try await self._synchronize(instance, method: HTTPMethod.put)
} catch {
self.rescheduleApiCallsIfNecessary()
StoreCenter.main.log(message: "PUT failed for \(instance)")
StoreCenter.main.log(message: "PUT failed for \(instance): \(error.localizedDescription)")
Logger.error(error)
}
return nil
@ -278,7 +278,7 @@ actor ApiCallCollection<T: Storable>: SomeCallCollection {
let _: Empty? = try await self._synchronize(instance, method: HTTPMethod.delete)
} catch {
self.rescheduleApiCallsIfNecessary()
StoreCenter.main.log(message: "DELETE failed for \(instance)")
StoreCenter.main.log(message: "DELETE failed for \(instance): \(error.localizedDescription)")
Logger.error(error)
}
return
@ -294,12 +294,6 @@ actor ApiCallCollection<T: Storable>: SomeCallCollection {
}
}
/// Executes an API call
/// For POST requests, potentially copies additional data coming from the server during the insert
// fileprivate func _executeApiCall(_ apiCall: ApiCall<T>) async throws -> T {
// return try await StoreCenter.main.execute(apiCall: apiCall)
// }
/// Executes an API call
/// For POST requests, potentially copies additional data coming from the server during the insert
fileprivate func _executeApiCall<V: Decodable>(_ apiCall: ApiCall<T>) async throws -> V {

Loading…
Cancel
Save