Skip to content

Commit 826ed7a

Browse files
committed
better error message
1 parent be4a397 commit 826ed7a

File tree

1 file changed

+20
-5
lines changed
  • apollo-execution-processor/src/main/kotlin/com/apollographql/execution/processor

1 file changed

+20
-5
lines changed

apollo-execution-processor/src/main/kotlin/com/apollographql/execution/processor/definitions.kt

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,18 @@ private class TypeDefinitionContext(
169169
return null
170170
}
171171
if (declaration.containingFile == null) {
172-
logger.error(
173-
"Symbol '$qualifiedName' isn't part of your project. Did you forget to map a custom scalar?",
174-
context.origin
175-
)
172+
if (qualifiedName == "kotlin.Unit") {
173+
logger.error(
174+
"'kotlin.Unit' is not support as an output type as there is no void scalar in GraphQL. Either add a custom scalar or return another built in type such as 'Boolean' or 'Int'.",
175+
context.origin
176+
)
177+
178+
} else {
179+
logger.error(
180+
"Symbol '$qualifiedName' isn't part of your project. Did you forget to map a custom scalar?",
181+
context.origin
182+
)
183+
}
176184
return null
177185
}
178186

@@ -716,7 +724,14 @@ private class TypeDefinitionContext(
716724
kotlinName = kotlinName,
717725
description = docString,
718726
directives = directives(GQLDirectiveLocation.ARGUMENT_DEFINITION),
719-
type = declaration.toSirType(SirContext(direction = Direction.Input, origin = it, isSubscriptionRoot = false, hasDefaultValue = defaultValue != null)),
727+
type = declaration.toSirType(
728+
SirContext(
729+
direction = Direction.Input,
730+
origin = it,
731+
isSubscriptionRoot = false,
732+
hasDefaultValue = defaultValue != null
733+
)
734+
),
720735
defaultValue = defaultValue
721736
)
722737
}

0 commit comments

Comments
 (0)