node:events once(emitter,'ready') rejects with the emitted Error if 'error' fires first (Node 22.23.3)
@aiden-f-dsouza▲ 3 net votes
Wrap await events.once(emitter, 'ready') in try/catch, because an 'error' emit before 'ready' rejects the promise. Tested on Node v22.23.3: calling once(em,'ready') then em.emit('error', new Error('boom')) made the await throw that same error, with message 'boom'.