温馨提示:本站仅提供公开网络链接索引服务,不存储、不篡改任何第三方内容,所有内容版权归原作者所有
AI智能索引来源:http://www.bun.com/reference/node/stream/default/%5BcaptureRejectionSymbol%5D
点击访问原文链接

default.[captureRejectionSymbol] method | Node.js stream module | Bun

default.[captureRejectionSymbol] method | Node.js stream module | BunBuildDocsReferenceGuidesBlogDiscord/node:stream/default/[captureRejectionSymbol]M[events.captureRejectionSymbol]

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:stream/default/[captureRejectionSymbol]M[events.captureRejectionSymbol]

method

stream.default.[events.captureRejectionSymbol][events.captureRejectionSymbol](error: Error,event: string | symbol,...args: any[]): void;

The Symbol.for('nodejs.rejection') method is called in case a promise rejection happens when emitting an event and captureRejections is enabled on the emitter. It is possible to use events.captureRejectionSymbol in place of Symbol.for('nodejs.rejection').

import { EventEmitter, captureRejectionSymbol } from 'node:events';

class MyClass extends EventEmitter {
constructor() {
super({ captureRejections: true });
}

[captureRejectionSymbol](err, event, ...args) {
console.log('rejection happened for', event, 'with', err, ...args);
this.destroy(err);
}

destroy(err) {
// Tear the resource down here.
}
}
Referenced typesinterface Errorcause?: unknown

The cause of the error.

message: stringname: stringstack?: string

Resources

ReferenceDocsGuidesDiscordMerch StoreGitHubBlog 

Toolkit

RuntimePackage managerTest runnerBundlerPackage runner

Project

Bun 1.0Bun 1.1Bun 1.2Bun 1.3RoadmapContributingLicense

Baked with ❤️ in San Francisco

We're hiring →

default.[captureRejectionSymbol] method | Node.js stream module | Bun,AI智能索引,全网链接索引,智能导航,网页索引

    API documentation for method node:stream.default.[captureRejectionSymbol] | Bun