apache/pulsar-client-node

Send timeout produces an incomprehensible error

Closed this issue · 2 comments

I change the timeout settings in examples/produce.js to 1 second, and run it without a running Pulsar server. The program failed due to timeout, but the error message is incomprehensible:

$ git --no-pager diff            
diff --git a/examples/producer.js b/examples/producer.js
index b859a17..e1e3c46 100644
--- a/examples/producer.js
+++ b/examples/producer.js
@@ -23,13 +23,13 @@ const Pulsar = require('../');
   // Create a client
   const client = new Pulsar.Client({
     serviceUrl: 'pulsar://localhost:6650',
-    operationTimeoutSeconds: 30,
+    operationTimeoutSeconds: 1,
   });
 
   // Create a producer
   const producer = await client.createProducer({
     topic: 'persistent://public/default/my-topic',
-    sendTimeoutMs: 30000,
+    sendTimeoutMs: 1000,
     batchingEnabled: true,
   });
 
$ node examples/producer
node:internal/process/promises:289
            triggerUncaughtException(err, true /* fromPromise */);
            ^

[Error: Failed to create producer: TimeOut]

Node.js v19.8.1

I'm wondering if we can throw a clear exception on this case.

cc @BewareMyPower @RobertIndie @shibd

[Error: Failed to create producer: TimeOut]

Is it not clear?

@BewareMyPower 🤣 You're right.