merge exception function