R exceptions handling