Skip to content

Commit 96b4952

Browse files
Merge pull request #5 from NeedleInAJayStack/feature/server-error-exposure
Server error exposure
2 parents fb105d0 + 64dedf4 commit 96b4952

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/GraphQLWS/Server.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class Server<InitPayload: Equatable & Codable> {
1818
var onExit: () -> Void = { }
1919
var onMessage: (String) -> Void = { _ in }
2020
var onOperationComplete: (String) -> Void = { _ in }
21-
var onOperationError: (String) -> Void = { _ in }
21+
var onOperationError: (String, [Error]) -> Void = { _, _ in }
2222

2323
var initialized = false
2424

@@ -128,7 +128,7 @@ public class Server<InitPayload: Equatable & Codable> {
128128

129129
/// Define the callback to run on error of any full operation (failed query, interrupted subscription)
130130
/// - Parameter callback: The callback to assign
131-
public func onOperationError(_ callback: @escaping (String) -> Void) {
131+
public func onOperationError(_ callback: @escaping (String, [Error]) -> Void) {
132132
self.onOperationError = callback
133133
}
134134

@@ -283,7 +283,7 @@ public class Server<InitPayload: Equatable & Codable> {
283283
id: id
284284
).toJSON(encoder)
285285
)
286-
onOperationError(id)
286+
onOperationError(id, errors)
287287
}
288288

289289
/// Send an `error` response through the messenger

0 commit comments

Comments
 (0)