\Header{stop}{Stop Function Execution}
\alias{geterrmessage}{stop}
\keyword{environment}{stop}
\keyword{programming}{stop}
\keyword{error}{stop}
\begin{Description}\relax
\code{stop} stops execution of the current expression, prints the
message given as its argument, then executes an error action.

\code{geterrmessage} gives the last error message.\end{Description}
\begin{Usage}
\begin{verbatim}
stop(message = NULL, call. = TRUE)
geterrmessage()
\end{verbatim}
\end{Usage}
\begin{Arguments}
\begin{ldescription}
\item[\code{message}] a character vector (of length 1) or \code{NULL}.
\item[\code{call.}] logical, indicating if the call should become part of the
error message.
\end{ldescription}
\end{Arguments}
\begin{Details}\relax
The error action is controlled by the current error handler set by
\code{options(error=)}. The default behaviour  (the \code{NULL}
error-handler) in interactive use is
to return to the top level prompt, and in non-interactive use to
(effectively) call \code{\Link{q}("no", status=1, runLast=FALSE}).\end{Details}
\begin{Value}
\code{geterrmessage} gives the last error message, as character string
ending in \code{"\\n"}.\end{Value}
\begin{SeeAlso}\relax
\code{\Link{warning}}, \code{\Link{restart}} to catch errors and retry,
and \code{\Link{options}} for setting error handlers.
\code{\Link{stopifnot}} for validity testing.\end{SeeAlso}
\begin{Examples}
\begin{ExampleCode}
options(error = expression(NULL))# don't stop on stop(.)  << Use with CARE! >>

iter <- 12
if(iter > 10) stop("too many iterations")

tst1 <- function(...) stop("dummy error")
tst1(1:10,long,calling,expression)

tst2 <- function(...) stop("dummy error", call. = FALSE)
tst2(1:10,long,calling,expression,but.not.seen.in.Error)

options(error = NULL)# revert to default
\end{ExampleCode}
\end{Examples}

