From 18e3a1119bd7f49b3343a23e6947e0483bbeea45 Mon Sep 17 00:00:00 2001 From: Aashish Patil Date: Tue, 1 Jul 2025 21:03:46 -0700 Subject: [PATCH] Include server error messages in DataConnectOperationError debug description --- Sources/DataConnectError.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Sources/DataConnectError.swift b/Sources/DataConnectError.swift index 9607fa8..01c2a8a 100644 --- a/Sources/DataConnectError.swift +++ b/Sources/DataConnectError.swift @@ -217,6 +217,15 @@ public struct DataConnectOperationError: DataConnectError { -> DataConnectOperationError { return DataConnectOperationError(message: message, cause: cause, response: response) } + + // include the underlying errors from errorInfo list in the description + public var debugDescription: String { + let errorInfos = response?.errors.compactMap { + $0.message + }.joined(separator: "\n") + + return "{\(Self.self), \nerrors: \(errorInfos) \noriginatingError: \(String(describing: underlyingError))}" + } } /// Contains the data and errors sent to us from the backend in its response.