Skip to content

Commit e232cd0

Browse files
Merge pull request #1372 from BetoFrega/build/log-input-type-name
feat(input-type-factory): logs the `InputType` class name, if it is available
2 parents e5380dd + 173df65 commit e232cd0

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed
Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
import { GqlTypeReference } from '../../interfaces';
2+
13
export class CannotDetermineInputTypeError extends Error {
2-
constructor(hostType: string) {
4+
constructor(hostType: string, typeRef?: GqlTypeReference) {
5+
const inputObjectName: string | false = typeof typeRef === 'function' && typeRef.name;
36
super(
4-
`Cannot determine a GraphQL input type for the "${hostType}". Make sure your class is decorated with an appropriate decorator.`,
7+
`Cannot determine a GraphQL input type ${inputObjectName ? `("${inputObjectName}") ` : null}for the "${hostType}". Make sure your class is decorated with an appropriate decorator.`,
58
);
69
}
710
}

lib/schema-builder/factories/input-type.factory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class InputTypeFactory {
3232
typeRef as any,
3333
);
3434
if (!inputType) {
35-
throw new CannotDetermineInputTypeError(hostType);
35+
throw new CannotDetermineInputTypeError(hostType, typeRef);
3636
}
3737
}
3838
return this.typeMapperService.mapToGqlType(

0 commit comments

Comments
 (0)