Skip to content

Server error exposure #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Sources/GraphQLWS/Server.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public class Server<InitPayload: Equatable & Codable> {
var onExit: () -> Void = { }
var onMessage: (String) -> Void = { _ in }
var onOperationComplete: (String) -> Void = { _ in }
var onOperationError: (String) -> Void = { _ in }
var onOperationError: (String, [Error]) -> Void = { _, _ in }

var initialized = false

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

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

Expand Down Expand Up @@ -283,7 +283,7 @@ public class Server<InitPayload: Equatable & Codable> {
id: id
).toJSON(encoder)
)
onOperationError(id)
onOperationError(id, errors)
}

/// Send an `error` response through the messenger
Expand Down