[dist] Better error handling and events