agreatfool / grpc_tools_node_protoc_ts

Generate TypeScript d.ts definitions for generated js files from grpc_tools_node_protoc
MIT License
498 stars 56 forks source link

Unable to catch error in try / catch #134

Closed jambudipa closed 11 months ago

jambudipa commented 1 year ago

The following code is throwing an error:

const client = new ChatServiceClient('localhost:8080', grpc.credentials.createInsecure());
const question = new Question(input);
const responseStream = client.AskQuestion(question, meta);

Now this service is unavailable, but wrapping this code block in try / catch seemingly has no effect. Why might that be?

I cannot see any way to handle this connection error and my node app just stops...

Error: 14 UNAVAILABLE: No connection established. Last error: connect ECONNREFUSED 127.0.0.1:8080 (2023-10-19T20:59:35.951Z)

agreatfool commented 1 year ago

@jambudipa You need to raise question to https://github.com/grpc/grpc-node/issues, this is the question about grpc itself, not about the typescript signature.

jambudipa commented 1 year ago

Aha ok, thanks, I’ll do that.