(a) After a discontinuance or voluntary nonsuit the plaintiff may commence a second action upon the same cause of action upon payment of the costs of the former action.(b) After the entry of a compulsory nonsuit the plaintiff may not commence a second action upon the same cause of action.