Skip to content

Commit

Permalink
Merge pull request #1372 from BetoFrega/build/log-input-type-name
Browse files Browse the repository at this point in the history
feat(input-type-factory): logs the `InputType` class name, if it is available
  • Loading branch information
kamilmysliwiec committed Oct 20, 2021
2 parents e5380dd + 173df65 commit e232cd0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { GqlTypeReference } from '../../interfaces';

export class CannotDetermineInputTypeError extends Error {
constructor(hostType: string) {
constructor(hostType: string, typeRef?: GqlTypeReference) {
const inputObjectName: string | false = typeof typeRef === 'function' && typeRef.name;
super(
`Cannot determine a GraphQL input type for the "${hostType}". Make sure your class is decorated with an appropriate decorator.`,
`Cannot determine a GraphQL input type ${inputObjectName ? `("${inputObjectName}") ` : null}for the "${hostType}". Make sure your class is decorated with an appropriate decorator.`,
);
}
}
2 changes: 1 addition & 1 deletion lib/schema-builder/factories/input-type.factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export class InputTypeFactory {
typeRef as any,
);
if (!inputType) {
throw new CannotDetermineInputTypeError(hostType);
throw new CannotDetermineInputTypeError(hostType, typeRef);
}
}
return this.typeMapperService.mapToGqlType(
Expand Down

0 comments on commit e232cd0

Please sign in to comment.