Added error handling to markup translation