trycatch                package:R.oo                R Documentation

_E_v_a_l_u_a_t_e_s _a_n _e_x_p_r_e_s_s_i_o_n _w_i_t_h _t_h_e _p_o_s_s_i_b_i_l_i_t_y _t_o _c_a_t_c_h _e_x_c_e_p_t_i_o_n_s (_D_E_P_R_E_C_A_T_E_D)

_D_e_s_c_r_i_p_t_i_o_n:

     _This function is deprecated. Use tryCatch() instead._

     Evaluates an expression with the possibility to catch exceptions.
     The class of the exception thrown by a standard 'stop()' call is
     'try-error'. Since it contains a dash, the name must be specfied
     within quotation marks. Alternatively, the name 'ANY' can be use
     to catch any exception. See examples below.

     Note that the order which the catch-expressions are specify is
     important. For instance, an 'ANY' catch at the beginning will
     catch all exception even if one specify other classes afterwards.

_U_s_a_g_e:

     trycatch(expr, ..., finally=NULL, envir=parent.frame())

_A_r_g_u_m_e_n_t_s:

    expr: The 'expression' to be evaluated.

     ...: A catch list of named 'expression's. The expression with the
          same name as the class of the 'Exception' thrown when
          evaluating 'expr' is called. If 'ANY', all exceptions are
          caught and the corresponding expression is evaluated.

 finally: An 'expression' that is guaranteed to be called even if the
          expression generates an exception.

   envir: The 'environment' in which the caught expression is to be
          evaluated.

_D_e_t_a_i_l_s:

     To make 'trycatch()' for other exception classes than 'try-error',
     the functions 'try()' and 'stop()' had to undergo minor(!)
     modification. However, they are fully compatible with the 'try'()
     and 'stop'() in the 'base' package.

     To make exceptions to be thrown in the catch expression, e.g. in
     'finally' or 'ANY', such exceptions should extend (inherit from)
     the class 'try-error', which is for instance the case with all
     stop() and throw() generated exceptions.

     Currently, from R v1.8.0 there is a new implementation of
     trycatch(), which is a "wrapper" around the new tryCatch()
     function. If running R v1.7.1 or before the old trycatch() is used
     for backward compatibility.

_V_a_l_u_e:

     Returns the value of the last 'expression' evaluated.

_A_u_t_h_o_r(_s):

     Henrik Bengtsson <URL: http://www.braju.com/R/>

_S_e_e _A_l_s_o:

     From R v1.8.0 the 'tryCatch()' method is available; see
     'conditions'. For more information about exceptions see
     'Exception'. There is also 'throw'(), 'stop'(), 'try'().

_E_x_a_m_p_l_e_s:

     ## Not run: For a complete example see help(Exception).

