Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log instead of throw new Error when receiving unknown events #216

Closed
hcfw007 opened this issue Dec 23, 2022 · 6 comments
Closed

log instead of throw new Error when receiving unknown events #216

hcfw007 opened this issue Dec 23, 2022 · 6 comments

Comments

@hcfw007
Copy link
Member

hcfw007 commented Dec 23, 2022

In current wechaty-puppet-service code, we throw an Error when receiving unknown grpc event:

throw new Error('eventType ' + type + ' unsupported! (code should not reach here)')

This error won't be caught by error listener and will break the system. If the bot has registered unhandled error listener on process, the puppet-service event listener will break and no futher events can be processed, which will result in system reset by watch dog. If there is no unhadled error lisener registered, the process will exit directly.

Thus we should change it by logging the error, or emit an error event. Since there might be new events in new versions of puppet and this will break the system for people using older versions.

@huan
Copy link
Member

huan commented Dec 23, 2022

I'd like to accept a Pull Request to make it a soft log instead of a hard exception.

@hcfw007
Copy link
Member Author

hcfw007 commented Jan 9, 2023

Issue closed since PR has been merged.

@xzc1366
Copy link

xzc1366 commented Mar 6, 2024

When I try to run npm install, an error occursl TypeError: Cannot use 'in' operator to search for 'port' in undefined

@missile-xuan
Copy link

当我尝试运行 npm install 时,出现错误 TypeError:无法使用“in”运算符在 undefined 中搜索“port”

me too

@lizihao001
Copy link

我想接受拉取请求以使其成为软日志而不是硬异常。

你好 我也有这样的问题
日志:
10:46:13 INFO PuppetSkeleton start()
10:46:13 INFO PuppetService start() instanciating GrpcManager ...
10:46:13 INFO PuppetService start() instanciating GrpcManager ... done
10:46:13 INFO PuppetService start() setting up bridge grpc event stream ...
10:46:13 INFO PuppetService start() setting up bridge grpc event stream ... done
10:46:13 INFO PuppetService start() starting grpc manager...
10:46:13 WARN last event was 1711622773.979 seconds ago, will not request event cache
10:46:13 WARN GrpcManager initClient() TLS: disabled (INSECURE)
10:46:13 INFO GrpcManager startStream() connecting event stream with account undefined and seq undefined
/workspaces/workpro-getting-started/node_modules/@grpc/grpc-js/src/subchannel-address.ts:40
return 'port' in address;
^
TypeError: Cannot use 'in' operator to search for 'port' in undefined
at isTcpSubchannelAddress (/workspaces/workpro-getting-started/node_modules/@grpc/grpc-js/src/subchannel-address.ts:40:16)
at interleaveAddressFamilies (/workspaces/workpro-getting-started/node_modules/@grpc/grpc-js/src/load-balancer-pick-first.ts:145:27)
at PickFirstLoadBalancer.updateAddressList (/workspaces/workpro-getting-started/node_modules/@grpc/grpc-js/src/load-balancer-pick-first.ts:533:25)
at ChildLoadBalancerHandler.updateAddressList (/workspaces/workpro-getting-started/node_modules/@grpc/grpc-js/src/load-balancer-child-handler.ts:137:19)
at onSuccessfulResolution (/workspaces/workpro-getting-started/node_modules/@grpc/grpc-js/src/resolving-load-balancer.ts:302:34)
at processTicksAndRejections (node:internal/process/task_queues:85:22)

@0-Vector
Copy link

我想接受拉取请求以使其成为软日志而不是硬异常。

你好 我也有这样的问题 日志: 10:46:13 INFO PuppetSkeleton start() 10:46:13 INFO PuppetService start() instanciating GrpcManager ... 10:46:13 INFO PuppetService start() instanciating GrpcManager ... done 10:46:13 INFO PuppetService start() setting up bridge grpc event stream ... 10:46:13 INFO PuppetService start() setting up bridge grpc event stream ... done 10:46:13 INFO PuppetService start() starting grpc manager... 10:46:13 WARN last event was 1711622773.979 seconds ago, will not request event cache 10:46:13 WARN GrpcManager initClient() TLS: disabled (INSECURE) 10:46:13 INFO GrpcManager startStream() connecting event stream with account undefined and seq undefined /workspaces/workpro-getting-started/node_modules/@grpc/grpc-js/src/subchannel-address.ts:40 return 'port' in address; ^ TypeError: Cannot use 'in' operator to search for 'port' in undefined at isTcpSubchannelAddress (/workspaces/workpro-getting-started/node_modules/@grpc/grpc-js/src/subchannel-address.ts:40:16) at interleaveAddressFamilies (/workspaces/workpro-getting-started/node_modules/@grpc/grpc-js/src/load-balancer-pick-first.ts:145:27) at PickFirstLoadBalancer.updateAddressList (/workspaces/workpro-getting-started/node_modules/@grpc/grpc-js/src/load-balancer-pick-first.ts:533:25) at ChildLoadBalancerHandler.updateAddressList (/workspaces/workpro-getting-started/node_modules/@grpc/grpc-js/src/load-balancer-child-handler.ts:137:19) at onSuccessfulResolution (/workspaces/workpro-getting-started/node_modules/@grpc/grpc-js/src/resolving-load-balancer.ts:302:34) at processTicksAndRejections (node:internal/process/task_queues:85:22)

怎么解决的?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants