Add error context into translation and type inference phase