Skip to content

Commit 41aed3a

Browse files
Include server error messages in DataConnectOperationError (#56)
1 parent 9ff6f43 commit 41aed3a

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

Sources/DataConnectError.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,15 @@ public struct DataConnectOperationError: DataConnectError {
217217
-> DataConnectOperationError {
218218
return DataConnectOperationError(message: message, cause: cause, response: response)
219219
}
220+
221+
// include the underlying errors from errorInfo list in the description
222+
public var debugDescription: String {
223+
let errorInfos = response?.errors.compactMap {
224+
$0.message
225+
}.joined(separator: "\n")
226+
227+
return "{\(Self.self), \nerrors: \(errorInfos) \noriginatingError: \(String(describing: underlyingError))}"
228+
}
220229
}
221230

222231
/// Contains the data and errors sent to us from the backend in its response.

0 commit comments

Comments
 (0)