Skip to content

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

@hcfw007

Description

@hcfw007

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions