fix: ensure event is emitted before task promise rejection