add flexible error mechanism