emit exit and errors