% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/error_http_generated.R, R/s3-classes.R
\name{http100}
\alias{http100}
\alias{http101}
\alias{http102}
\alias{http200}
\alias{http201}
\alias{http202}
\alias{http203}
\alias{http204}
\alias{http205}
\alias{http206}
\alias{http207}
\alias{http208}
\alias{http226}
\alias{http300}
\alias{http301}
\alias{http302}
\alias{http303}
\alias{http304}
\alias{http305}
\alias{http306}
\alias{http307}
\alias{http308}
\alias{http400}
\alias{http401}
\alias{http402}
\alias{http403}
\alias{http404}
\alias{http405}
\alias{http406}
\alias{http407}
\alias{http408}
\alias{http409}
\alias{http410}
\alias{http411}
\alias{http412}
\alias{http413}
\alias{http414}
\alias{http415}
\alias{http416}
\alias{http417}
\alias{http418}
\alias{http419}
\alias{http420}
\alias{http422}
\alias{http423}
\alias{http424}
\alias{http425}
\alias{http426}
\alias{http428}
\alias{http429}
\alias{http431}
\alias{http440}
\alias{http444}
\alias{http449}
\alias{http450}
\alias{http451}
\alias{http494}
\alias{http495}
\alias{http496}
\alias{http497}
\alias{http498}
\alias{http499}
\alias{http500}
\alias{http501}
\alias{http502}
\alias{http503}
\alias{http504}
\alias{http505}
\alias{http506}
\alias{http507}
\alias{http508}
\alias{http509}
\alias{http510}
\alias{http511}
\alias{http598}
\alias{http599}
\alias{http}
\title{higher level error wrappers}
\usage{
http100(response, behavior = "auto", message_template, muffle = FALSE)

http101(response, behavior = "auto", message_template, muffle = FALSE)

http102(response, behavior = "auto", message_template, muffle = FALSE)

http200(response, behavior = "auto", message_template, muffle = FALSE)

http201(response, behavior = "auto", message_template, muffle = FALSE)

http202(response, behavior = "auto", message_template, muffle = FALSE)

http203(response, behavior = "auto", message_template, muffle = FALSE)

http204(response, behavior = "auto", message_template, muffle = FALSE)

http205(response, behavior = "auto", message_template, muffle = FALSE)

http206(response, behavior = "auto", message_template, muffle = FALSE)

http207(response, behavior = "auto", message_template, muffle = FALSE)

http208(response, behavior = "auto", message_template, muffle = FALSE)

http226(response, behavior = "auto", message_template, muffle = FALSE)

http300(response, behavior = "auto", message_template, muffle = FALSE)

http301(response, behavior = "auto", message_template, muffle = FALSE)

http302(response, behavior = "auto", message_template, muffle = FALSE)

http303(response, behavior = "auto", message_template, muffle = FALSE)

http304(response, behavior = "auto", message_template, muffle = FALSE)

http305(response, behavior = "auto", message_template, muffle = FALSE)

http306(response, behavior = "auto", message_template, muffle = FALSE)

http307(response, behavior = "auto", message_template, muffle = FALSE)

http308(response, behavior = "auto", message_template, muffle = FALSE)

http400(response, behavior = "auto", message_template, muffle = FALSE)

http401(response, behavior = "auto", message_template, muffle = FALSE)

http402(response, behavior = "auto", message_template, muffle = FALSE)

http403(response, behavior = "auto", message_template, muffle = FALSE)

http404(response, behavior = "auto", message_template, muffle = FALSE)

http405(response, behavior = "auto", message_template, muffle = FALSE)

http406(response, behavior = "auto", message_template, muffle = FALSE)

http407(response, behavior = "auto", message_template, muffle = FALSE)

http408(response, behavior = "auto", message_template, muffle = FALSE)

http409(response, behavior = "auto", message_template, muffle = FALSE)

http410(response, behavior = "auto", message_template, muffle = FALSE)

http411(response, behavior = "auto", message_template, muffle = FALSE)

http412(response, behavior = "auto", message_template, muffle = FALSE)

http413(response, behavior = "auto", message_template, muffle = FALSE)

http414(response, behavior = "auto", message_template, muffle = FALSE)

http415(response, behavior = "auto", message_template, muffle = FALSE)

http416(response, behavior = "auto", message_template, muffle = FALSE)

http417(response, behavior = "auto", message_template, muffle = FALSE)

http418(response, behavior = "auto", message_template, muffle = FALSE)

http419(response, behavior = "auto", message_template, muffle = FALSE)

http420(response, behavior = "auto", message_template, muffle = FALSE)

http422(response, behavior = "auto", message_template, muffle = FALSE)

http423(response, behavior = "auto", message_template, muffle = FALSE)

http424(response, behavior = "auto", message_template, muffle = FALSE)

http425(response, behavior = "auto", message_template, muffle = FALSE)

http426(response, behavior = "auto", message_template, muffle = FALSE)

http428(response, behavior = "auto", message_template, muffle = FALSE)

http429(response, behavior = "auto", message_template, muffle = FALSE)

http431(response, behavior = "auto", message_template, muffle = FALSE)

http440(response, behavior = "auto", message_template, muffle = FALSE)

http444(response, behavior = "auto", message_template, muffle = FALSE)

http449(response, behavior = "auto", message_template, muffle = FALSE)

http450(response, behavior = "auto", message_template, muffle = FALSE)

http451(response, behavior = "auto", message_template, muffle = FALSE)

http494(response, behavior = "auto", message_template, muffle = FALSE)

http495(response, behavior = "auto", message_template, muffle = FALSE)

http496(response, behavior = "auto", message_template, muffle = FALSE)

http497(response, behavior = "auto", message_template, muffle = FALSE)

http498(response, behavior = "auto", message_template, muffle = FALSE)

http499(response, behavior = "auto", message_template, muffle = FALSE)

http500(response, behavior = "auto", message_template, muffle = FALSE)

http501(response, behavior = "auto", message_template, muffle = FALSE)

http502(response, behavior = "auto", message_template, muffle = FALSE)

http503(response, behavior = "auto", message_template, muffle = FALSE)

http504(response, behavior = "auto", message_template, muffle = FALSE)

http505(response, behavior = "auto", message_template, muffle = FALSE)

http506(response, behavior = "auto", message_template, muffle = FALSE)

http507(response, behavior = "auto", message_template, muffle = FALSE)

http508(response, behavior = "auto", message_template, muffle = FALSE)

http509(response, behavior = "auto", message_template, muffle = FALSE)

http510(response, behavior = "auto", message_template, muffle = FALSE)

http511(response, behavior = "auto", message_template, muffle = FALSE)

http598(response, behavior = "auto", message_template, muffle = FALSE)

http599(response, behavior = "auto", message_template, muffle = FALSE)

http(response, behavior = "auto", message_template, muffle = FALSE)
}
\arguments{
\item{response}{The result of a call via \pkg{crul}, \pkg{curl}, or
\pkg{httr}}

\item{behavior}{Behavior of the error. default: auto. See Details}

\item{message_template}{A message template. optional. use whisker
templating. names to use are: reason and status. use in template
like \code{\{\{reason\}\}} and  \code{\{\{status\}\}}. Note that
\code{\{\{message\}\}} that is used in \code{message_template_verbose}
will be ignored here.}

\item{muffle}{(logical) whether to not respond when status codes
in 1xx-3xx series. Default: \code{FALSE}}
}
\description{
higher level error wrappers
}
\note{
These \code{http*} methods only use \code{$do} and not
\code{$do_verbose}.
}
\section{behavior parameter options}{

\itemize{
 \item stop - use \code{stop}
 \item warning - use \code{warning}
 \item message - use \code{message}
 \item auto - toggle between \code{stop} and \code{message} depending
 on the HTTP status code series. Defaults will be:
 \itemize{
  \item 1xx: \code{message}
  \item 2xx: \code{message}
  \item 3xx: \code{message}
  \item 4xx: \code{stop}
  \item 5xx: \code{stop}
 }
}

Of course, you can always override the defaults.
}

\section{using package \pkg{curl}}{

curl reponses are simple lists, so we have little to go on to make sure
it's a response from the \pkg{curl} package. We check for list names
internally but of course you could pass in a list with the right named
elements, while the values are complete nonsense, in which case
we'll probably fail badly. There's not much we can do.
}

\examples{
if (requireNamespace("crul")) {
 library("crul")
 res <- HttpClient$new("https://httpbin.org/status/418")$get()
 \dontrun{http(res)}
 http(res, behavior = "warning")
 http(res, behavior = "message")

 res <- HttpClient$new("https://httpbin.org/status/414")$get()
 \dontrun{http414(res)}
 http(res, behavior = "warning")
 http(res, behavior = "message")

 res <- HttpClient$new("https://httpbin.org/asdfafadsf")$get()
 \dontrun{http404(res)}
 http(res, behavior = "warning")
 http(res, behavior = "message")
}

if (requireNamespace("curl")) {
 library("curl")
 h <- curl::new_handle()
 curl::handle_setopt(h)
 res <- curl::curl_fetch_memory("https://httpbin.org/status/418", h)
 \dontrun{http(res)}
 http(res, behavior = "warning")
 http(res, behavior = "message")
}

if (requireNamespace("httr")) {
 library("httr")
 res <- GET("https://httpbin.org/status/418")
 \dontrun{http(res)}
 http(res, behavior = "warning")
 http(res, behavior = "message")
}

# muffle responses
if (requireNamespace("crul")) {
 library("crul")
 res201 <- HttpClient$new("https://httpbin.org")$get("status/201")
 res404 <- HttpClient$new("https://httpbin.org")$get("status/404")
 # status codes < 300 CAN be muffled - i.e., return the http response object
 http(res201, muffle = TRUE)
 # status codes > 300 CAN NOT be muffled - i.e., return the http response object
 \dontrun{
 http(res404, muffle = TRUE)
 }
}
}
\seealso{
\code{\link{Error}}, \code{\link[fauxpas]{Error-Classes}}
}
