Collect warnings and just warn once.
Arguments
- expr
R expression
- lst
When
TRUEreturn a list with list(object,warnings) instead of issuing the warnings. Otherwise, whenFALSEissue the warnings and return the object.- collectErr
When
TRUE, errors raised during evaluation ofexprare recorded in addition to warnings. A calling handler captures every error message as it is signalled, then lets the condition continue to propagate so that innertry()/tryCatch()blocks inexprkeep working as usual. An outertryCatch()catches errors that escape all inner handling, so the call always returns instead of stopping. Ifexprevaluated to a result (i.e. no error escaped), the recorded errors were caught by inner handlers and are discarded. If an error did escape, every message observed along the error chain (including follow-up errors raised byon.exithandlers, see issue 607) is returned in theerrorelement of the result list (whenlst = TRUE) or re-raised joined by newlines (whenlst = FALSE). WhenFALSE(the default) errors propagate normally andesis alwaysNULL. This is used bynlmixr2Est0()so that all errors from a failed estimation run are reported together rather than only the last one.
Value
The value of the expression, or when lst = TRUE a
list of the form list(object, warning = ws, error = es)
where ws and es are character vectors of unique
warning and error messages (es is always NULL
when collectErr = FALSE, and is also NULL when
the expression evaluated successfully under collectErr =
TRUE).
