Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Exceptions like client.close/subscription.close cannot be catched #429

Open

Description

Not sure what would be better here, that either the exception should be catchable or it should be idempotent.

const Pulsar = require("pulsar-client");
const STAGING = {
 serviceUrl: "pulsar+ssl://any-server:6651",
};
async function main() {
 const client = new Pulsar.Client({
 ...STAGING,
 logLevel: Pulsar.LogLevel.ERROR,
 log: (level, file, line, message) => {
 console.log(`[${level}] ${file}:${line}: ${message}`);
 },
 });
 try {
 await client.close();
 await client.close();
 } catch (error) {
 console.error("omg closing client:", error);
 }
}
main();
{
 "dependencies": {
 "pulsar-client": "^1.14.0"
 }
}

Will throw

node error-report.js
node:internal/process/promises:391
 triggerUncaughtException(err, true /* fromPromise */);
 ^
[Error: Failed to close client: AlreadyClosed]
Node.js v20.18.1

Even though I catched it

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

        AltStyle によって変換されたページ (->オリジナル) /