From 866d0193b465eac0028c0f9079ff407dcd9c5822 Mon Sep 17 00:00:00 2001 From: Xin Liu Date: Sat, 14 Sep 2024 04:35:59 -0700 Subject: [PATCH] More debug logs for failed name/publish requests --- Planet/Entities/MyPlanetModel.swift | 1 + Planet/IPFS/IPFSDaemon.swift | 4 ++++ Planet/Views/Sidebar/PlanetSidebarView.swift | 2 +- Planet/versioning.xcconfig | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Planet/Entities/MyPlanetModel.swift b/Planet/Entities/MyPlanetModel.swift index 42264550..135f2345 100644 --- a/Planet/Entities/MyPlanetModel.swift +++ b/Planet/Entities/MyPlanetModel.swift @@ -1792,6 +1792,7 @@ class MyPlanetModel: Equatable, Hashable, Identifiable, ObservableObject, Codabl try KeychainHelper.shared.importKeyFromKeychain(forPlanetKeyName: id.uuidString) } let cid = try await IPFSDaemon.shared.addDirectory(url: publicBasePath) + debugPrint("Publishing the latest CID for \(name): \(cid)") // Send the latest CID to dWebServices.xyz if enabled if let dWebServicesEnabled = dWebServicesEnabled, dWebServicesEnabled, let dWebServicesDomain = dWebServicesDomain, let dWebServicesAPIKey = dWebServicesAPIKey diff --git a/Planet/IPFS/IPFSDaemon.swift b/Planet/IPFS/IPFSDaemon.swift index 0b73d253..6fcb42b4 100644 --- a/Planet/IPFS/IPFSDaemon.swift +++ b/Planet/IPFS/IPFSDaemon.swift @@ -692,6 +692,10 @@ actor IPFSDaemon { let httpResponse = response as? HTTPURLResponse, httpResponse.ok else { + if let errorDetails = String(data: data, encoding: .utf8) { + debugPrint("Failed to access IPFS API \(path): \(errorDetails)") + } + debugPrint("IPFS API Error: \(response)") throw PlanetError.IPFSAPIError } // debugPrint the response diff --git a/Planet/Views/Sidebar/PlanetSidebarView.swift b/Planet/Views/Sidebar/PlanetSidebarView.swift index c225cf25..7e2c1d91 100644 --- a/Planet/Views/Sidebar/PlanetSidebarView.swift +++ b/Planet/Views/Sidebar/PlanetSidebarView.swift @@ -194,7 +194,7 @@ struct PlanetSidebarView: View { try await planet.publish() } catch { - debugPrint("Failed to publish: \(planet.name) id=\(planet.id)") + debugPrint("Failed to publish: \(planet.name) id=\(planet.id) error=\(error)") } } } diff --git a/Planet/versioning.xcconfig b/Planet/versioning.xcconfig index ad5cd8c4..5e0f70c1 100644 --- a/Planet/versioning.xcconfig +++ b/Planet/versioning.xcconfig @@ -1 +1 @@ -CURRENT_PROJECT_VERSION = 2240 +CURRENT_PROJECT_VERSION = 2241