1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/errors.R
\name{UnhandledHTTPRequestError}
\alias{UnhandledHTTPRequestError}
\alias{vcr_last_error}
\title{UnhandledHTTPRequestError}
\usage{
vcr_last_error()
}
\description{
Handle http request errors
}
\details{
How this error class is used:
If \code{record="once"} we trigger this.
Users can use vcr in the context of both \code{\link[=use_cassette]{use_cassette()}}
and \code{\link[=insert_cassette]{insert_cassette()}}
For the former, all requests go through the call_block
But for the latter, requests go through webmockr.
Where is one place where we can put UnhandledHTTPRequestError
that will handle both use_cassette and insert_cassette?
}
\section{Error situations where this is invoked}{
\itemize{
\item \code{record=once} AND there's a new request that doesn't match
the one in the cassette on disk
\itemize{
\item in webmockr: if no stub found and there are recorded
interactions on the cassette, and record = once, then
error with UnhandledHTTPRequestError
\itemize{
\item but if record != once, then allow it, unless record == none
}
}
\item others?
}
}
\examples{
vcr_configure(dir = tempdir())
cassettes()
insert_cassette("turtle")
request <- Request$new("post", 'https://eu.httpbin.org/post?a=5',
"", list(foo = "bar"))
err <- UnhandledHTTPRequestError$new(request)
err$request_description()
err$current_matchers()
err$match_request_on_headers()
err$match_request_on_body()
err$formatted_headers()
cat(err$formatted_headers(), "\n")
cat(err$cassettes_description(), "\n")
cat(err$cassettes_list(), "\n")
err$formatted_suggestions()
cat(err$format_bullet_point('foo bar', 1), "\n")
err$suggestion_for("use_new_episodes")
err$suggestions()
err$no_cassette_suggestions()
err$record_mode_suggestion()
err$has_used_interaction_matching()
err$match_requests_on_suggestion()
# err$construct_message()
# cleanup
eject_cassette("turtle")
unlink(tempdir())
\dontrun{
# vcr_last_error()
}
}
\section{Public fields}{
\if{html}{\out{<div class="r6-fields">}}
\describe{
\item{\code{request}}{a \link{Request} object}
\item{\code{cassette}}{a cassette name}
}
\if{html}{\out{</div>}}
}
\section{Methods}{
\subsection{Public methods}{
\itemize{
\item \href{#method-new}{\code{UnhandledHTTPRequestError$new()}}
\item \href{#method-run}{\code{UnhandledHTTPRequestError$run()}}
\item \href{#method-construct_message}{\code{UnhandledHTTPRequestError$construct_message()}}
\item \href{#method-request_description}{\code{UnhandledHTTPRequestError$request_description()}}
\item \href{#method-current_matchers}{\code{UnhandledHTTPRequestError$current_matchers()}}
\item \href{#method-match_request_on_headers}{\code{UnhandledHTTPRequestError$match_request_on_headers()}}
\item \href{#method-match_request_on_body}{\code{UnhandledHTTPRequestError$match_request_on_body()}}
\item \href{#method-formatted_headers}{\code{UnhandledHTTPRequestError$formatted_headers()}}
\item \href{#method-cassettes_description}{\code{UnhandledHTTPRequestError$cassettes_description()}}
\item \href{#method-cassettes_list}{\code{UnhandledHTTPRequestError$cassettes_list()}}
\item \href{#method-get_help}{\code{UnhandledHTTPRequestError$get_help()}}
\item \href{#method-formatted_suggestions}{\code{UnhandledHTTPRequestError$formatted_suggestions()}}
\item \href{#method-format_bullet_point}{\code{UnhandledHTTPRequestError$format_bullet_point()}}
\item \href{#method-format_foot_note}{\code{UnhandledHTTPRequestError$format_foot_note()}}
\item \href{#method-suggestion_for}{\code{UnhandledHTTPRequestError$suggestion_for()}}
\item \href{#method-suggestions}{\code{UnhandledHTTPRequestError$suggestions()}}
\item \href{#method-no_cassette_suggestions}{\code{UnhandledHTTPRequestError$no_cassette_suggestions()}}
\item \href{#method-record_mode_suggestion}{\code{UnhandledHTTPRequestError$record_mode_suggestion()}}
\item \href{#method-has_used_interaction_matching}{\code{UnhandledHTTPRequestError$has_used_interaction_matching()}}
\item \href{#method-match_requests_on_suggestion}{\code{UnhandledHTTPRequestError$match_requests_on_suggestion()}}
\item \href{#method-clone}{\code{UnhandledHTTPRequestError$clone()}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-new"></a>}}
\if{latex}{\out{\hypertarget{method-new}{}}}
\subsection{Method \code{new()}}{
Create a new \code{UnhandledHTTPRequestError} object
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$new(request)}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{request}}{(Request) a \link{Request} object}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
A new \code{UnhandledHTTPRequestError} object
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-run"></a>}}
\if{latex}{\out{\hypertarget{method-run}{}}}
\subsection{Method \code{run()}}{
Run unhandled request handling
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$run()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
various
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-construct_message"></a>}}
\if{latex}{\out{\hypertarget{method-construct_message}{}}}
\subsection{Method \code{construct_message()}}{
Construct and execute stop message for why request failed
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$construct_message()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
a stop message
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-request_description"></a>}}
\if{latex}{\out{\hypertarget{method-request_description}{}}}
\subsection{Method \code{request_description()}}{
construct request description
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$request_description()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
character
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-current_matchers"></a>}}
\if{latex}{\out{\hypertarget{method-current_matchers}{}}}
\subsection{Method \code{current_matchers()}}{
get current request matchers
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$current_matchers()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
character
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-match_request_on_headers"></a>}}
\if{latex}{\out{\hypertarget{method-match_request_on_headers}{}}}
\subsection{Method \code{match_request_on_headers()}}{
are headers included in current matchers?
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$match_request_on_headers()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
logical
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-match_request_on_body"></a>}}
\if{latex}{\out{\hypertarget{method-match_request_on_body}{}}}
\subsection{Method \code{match_request_on_body()}}{
is body includled in current matchers?
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$match_request_on_body()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
logical
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-formatted_headers"></a>}}
\if{latex}{\out{\hypertarget{method-formatted_headers}{}}}
\subsection{Method \code{formatted_headers()}}{
get request headers
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$formatted_headers()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
character
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-cassettes_description"></a>}}
\if{latex}{\out{\hypertarget{method-cassettes_description}{}}}
\subsection{Method \code{cassettes_description()}}{
construct description of current or lack thereof cassettes
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$cassettes_description()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
character
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-cassettes_list"></a>}}
\if{latex}{\out{\hypertarget{method-cassettes_list}{}}}
\subsection{Method \code{cassettes_list()}}{
cassette details
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$cassettes_list()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
character
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-get_help"></a>}}
\if{latex}{\out{\hypertarget{method-get_help}{}}}
\subsection{Method \code{get_help()}}{
get help message for non-verbose error
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$get_help()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
character
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-formatted_suggestions"></a>}}
\if{latex}{\out{\hypertarget{method-formatted_suggestions}{}}}
\subsection{Method \code{formatted_suggestions()}}{
make suggestions for what to do
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$formatted_suggestions()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
character
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-format_bullet_point"></a>}}
\if{latex}{\out{\hypertarget{method-format_bullet_point}{}}}
\subsection{Method \code{format_bullet_point()}}{
add bullet point to beginning of a line
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$format_bullet_point(lines, index)}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{lines}}{(character) vector of strings}
\item{\code{index}}{(integer) a number}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
character
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-format_foot_note"></a>}}
\if{latex}{\out{\hypertarget{method-format_foot_note}{}}}
\subsection{Method \code{format_foot_note()}}{
make a foot note
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$format_foot_note(url, index)}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{url}}{(character) a url}
\item{\code{index}}{(integer) a number}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
character
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-suggestion_for"></a>}}
\if{latex}{\out{\hypertarget{method-suggestion_for}{}}}
\subsection{Method \code{suggestion_for()}}{
get a suggestion by key
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$suggestion_for(key)}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{key}}{(character) a character string}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
character
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-suggestions"></a>}}
\if{latex}{\out{\hypertarget{method-suggestions}{}}}
\subsection{Method \code{suggestions()}}{
get all suggestions
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$suggestions()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
list
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-no_cassette_suggestions"></a>}}
\if{latex}{\out{\hypertarget{method-no_cassette_suggestions}{}}}
\subsection{Method \code{no_cassette_suggestions()}}{
get all no cassette suggestions
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$no_cassette_suggestions()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
list
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-record_mode_suggestion"></a>}}
\if{latex}{\out{\hypertarget{method-record_mode_suggestion}{}}}
\subsection{Method \code{record_mode_suggestion()}}{
get the appropriate record mode suggestion
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$record_mode_suggestion()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
character
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-has_used_interaction_matching"></a>}}
\if{latex}{\out{\hypertarget{method-has_used_interaction_matching}{}}}
\subsection{Method \code{has_used_interaction_matching()}}{
are there any used interactions
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$has_used_interaction_matching()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
logical
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-match_requests_on_suggestion"></a>}}
\if{latex}{\out{\hypertarget{method-match_requests_on_suggestion}{}}}
\subsection{Method \code{match_requests_on_suggestion()}}{
match requests on suggestion
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$match_requests_on_suggestion()}\if{html}{\out{</div>}}
}
\subsection{Returns}{
list
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-clone"></a>}}
\if{latex}{\out{\hypertarget{method-clone}{}}}
\subsection{Method \code{clone()}}{
The objects of this class are cloneable with this method.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{UnhandledHTTPRequestError$clone(deep = FALSE)}\if{html}{\out{</div>}}
}
\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{deep}}{Whether to make a deep clone.}
}
\if{html}{\out{</div>}}
}
}
}
|