Skip to content

Commit 5ab2866

Browse files
Merge branch 'feature/improved-error-handling' into 'master'
Improved Error Logging See merge request PassiveLogic/platform/graphqlws!2
2 parents 1e0c4ed + 020b560 commit 5ab2866

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

Sources/GraphQLWS/GraphQLWSError.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// Copyright (c) 2021 PassiveLogic, Inc.
2+
import GraphQL
23

34
struct GraphQLWSError: Error {
45
let message: String
@@ -72,9 +73,9 @@ struct GraphQLWSError: Error {
7273
)
7374
}
7475

75-
static func internalAPIStreamIssue() -> Self {
76+
static func internalAPIStreamIssue(errors: [GraphQLError]) -> Self {
7677
return self.init(
77-
"API Response did not result in a stream type",
78+
"API Response did not result in a stream type, contained errors\n\(errors.map { $0.message}.joined(separator: "\n"))",
7879
code: .internalAPIStreamIssue
7980
)
8081
}

Sources/GraphQLWS/Server.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public class Server {
155155
subscribeFuture.whenSuccess { result in
156156
guard let streamOpt = result.stream else {
157157
// API issue - subscribe resolver isn't stream
158-
self.error(.internalAPIStreamIssue())
158+
self.error(.internalAPIStreamIssue(errors: result.errors))
159159
return
160160
}
161161
let stream = streamOpt as! ObservableSubscriptionEventStream

0 commit comments

Comments
 (0)