-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent illegal resolver invocation and use way to access children cache
Signed-off-by: Arda TANRIKULU <ardatanrikulu@gmail.com>
- Loading branch information
Showing
4 changed files
with
64 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
export class IllegalResolverInvocationError extends Error { | ||
constructor(private _resolverPath: string, private _moduleName: string, private _detail: string) { | ||
super(` | ||
GraphQL-Modules Error: Illegal Resolver Invocation! | ||
- Resolver #${_resolverPath} is invoked unsafely outside of GraphQL-Modules. | ||
-- Detail: ${_detail} | ||
Possible solutions: | ||
- You may forget to pass context of the module to your GraphQL Server. | ||
-- Check if it is passed like below; | ||
--- const { schema, context } = YourModule; | ||
--- new ApolloServer({ schema, context });' | ||
`); | ||
Object.setPrototypeOf(this, IllegalResolverInvocationError.prototype); | ||
Error.captureStackTrace(this, IllegalResolverInvocationError); | ||
} | ||
get resolverPath() { | ||
return this._resolverPath; | ||
} | ||
get moduleName() { | ||
return this._moduleName; | ||
} | ||
get detail() { | ||
return this._detail; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters