Skip to content

Commit 25a3a7c

Browse files
committed
throw error instead of fatal error
1 parent 0428770 commit 25a3a7c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Sources/Graphiti/Schema/Schema.swift

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
import GraphQL
22
import NIO
33

4+
public struct SchemaError: Error, Equatable {
5+
let description: String
6+
}
7+
48
public final class Schema<Resolver, Context> {
59
public let schema: GraphQLSchema
610

@@ -17,7 +21,7 @@ public final class Schema<Resolver, Context> {
1721
}
1822

1923
guard typeProvider.query != nil || !typeProvider.federatedResolvers.isEmpty else {
20-
fatalError("Schema must contain at least 1 query or federated resolver")
24+
throw SchemaError(description: "Schema must contain at least 1 query or federated resolver")
2125
}
2226

2327
schema = try GraphQLSchema(

0 commit comments

Comments
 (0)