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

Socket.[captureRejectionSymbol] method | Node.js dgram module | Bun

Socket.[captureRejectionSymbol] method | Node.js dgram module | BunBuildDocsReferenceGuidesBlogDiscord/node:dgram/Socket/[captureRejectionSymbol]M[events.captureRejectionSymbol]

Search the reference...

/

BuildDocsReferenceGuidesBlogDiscord/node:dgram/Socket/[captureRejectionSymbol]M[events.captureRejectionSymbol]

method

dgram.Socket.[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?: unknownThe 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.3RoadmapContributingLicenseBaked with ❤️ in San Francisco

We're hiring →

智能索引记录