fix: improve error handling in GraphQL connection parameters
- Replaced error throws with logging for missing connection parameters in the GraphQL module. - Enhanced the logging mechanism to provide better insights during connection failures, improving overall debugging and monitoring capabilities.
This commit is contained in:
@@ -109,10 +109,10 @@ import { PubSubService } from 'src/PubSub/pubsub.service'
|
|||||||
'graphql-ws': {
|
'graphql-ws': {
|
||||||
onConnect: (ctx: Context<Record<string, unknown>>) => {
|
onConnect: (ctx: Context<Record<string, unknown>>) => {
|
||||||
if (!ctx.connectionParams) {
|
if (!ctx.connectionParams) {
|
||||||
throw new Error('No connectionParams provided')
|
Logger.log('No connectionParams provided', 'GraphqlModule')
|
||||||
}
|
}
|
||||||
if (!ctx.extra) {
|
if (!ctx.extra) {
|
||||||
throw new Error('No extra provided')
|
Logger.log('No extra provided', 'GraphqlModule')
|
||||||
}
|
}
|
||||||
// @ts-expect-error: Request is not typed
|
// @ts-expect-error: Request is not typed
|
||||||
ctx.extra.request.headers['x-session-id'] = ctx.connectionParams['x-session-id']
|
ctx.extra.request.headers['x-session-id'] = ctx.connectionParams['x-session-id']
|
||||||
|
|||||||
Reference in New Issue
Block a user