throw errors instead of using emit when sync; emit errors when it is async