Skip to content
This repository was archived by the owner on Sep 25, 2020. It is now read-only.
This repository was archived by the owner on Sep 25, 2020. It is now read-only.

The -t option shouldn't crash tcurl when the service can't be found #96

@lopter

Description

@lopter

If you pass a directory to the -t option but your service name doesn't match the name of your thrift IDL file then tcurl crashes:

/usr/lib/node_modules/tcurl/index.js:292
        delegate.error('Spec for service "' +
                 ^
TypeError: Cannot call method 'error' of undefined
    at TCurl.readThriftDir (/usr/lib/node_modules/tcurl/index.js:292:18)
    at TCurl.readThrift (/usr/lib/node_modules/tcurl/index.js:275:17)
    at TCurl.asThrift (/usr/lib/node_modules/tcurl/index.js:385:23)
    at TCurl.send (/usr/lib/node_modules/tcurl/index.js:353:14)
    at onReady (/usr/lib/node_modules/tcurl/index.js:375:14)
    at onIdentified (/usr/lib/node_modules/tcurl/index.js:334:9)
    at finish (/usr/lib/node_modules/tcurl/node_modules/tchannel/peer.js:463:9)
    at Array.onIdentified [as 1] (/usr/lib/node_modules/tcurl/node_modules/tchannel/peer.js:454:9)
    at DefinedEvent.emit (/usr/lib/node_modules/tcurl/node_modules/tchannel/lib/event_emitter.js:90:25)
    at TChannelConnection.onOutIdentified (/usr/lib/node_modules/tcurl/node_modules/tchannel/connection.js:460:26)

Moreover, it feels like tcurl is relying on a convention here (your thrift definition has to be in a specific place and format that matches your service name) but I haven't seen this convention documented anywhere. Maybe the -t option should be implemented differently? or maybe it should extract the service name from the endpoint argument (since, as far as I understand, its format is ServiceName::endPoint).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions