[cleanup] Do all error emission in the frontend

@ibuclaw