type-graphql
Version:
Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
16 lines (15 loc) • 648 B
JavaScript
export class NoExplicitTypeError extends Error {
constructor(typeName, propertyKey, parameterIndex, argName) {
let errorMessage = `Unable to infer GraphQL type from TypeScript reflection system. ` +
`You need to provide explicit type for `;
if (argName) {
errorMessage += `argument named '${argName}' of `;
}
else if (parameterIndex !== undefined) {
errorMessage += `parameter #${parameterIndex} of `;
}
errorMessage += `'${propertyKey}' of '${typeName}' class.`;
super(errorMessage);
Object.setPrototypeOf(this, new.target.prototype);
}
}