Shorthands for envelope() that fill in the user-facing error sentence for
their status. error is what a user reads; detail is what a log records.
Usage
status_ok(data, source = "API", http = 200L)
status_no_data(source = "API", http = NA_integer_, detail = NULL)
status_stale(data, source = "API", detail = NULL)
status_rate_limited(source = "API", http = 429L, detail = NULL)
status_timeout(source = "API", detail = NULL)
status_skipped(source = "API", detail = NULL)
status_error(source = "API", http = NA_integer_, error = NULL, detail = NULL)Arguments
- data
The parsed body on success,
NULLotherwise.- source
A friendly label for the service, used in the user-facing message. For example
"gnomAD".- http
The HTTP status code, or
NA_integer_when no response arrived.- detail
The technical cause, for a log. Never shown to a user.
- error
One sentence fit to show a user. Never carries technical detail.
Value
An envelope list, as described in envelope().
Details
The sentence comes from status_message(), so setting
biohttp.status_message changes what these produce too.
Examples
status_ok(data = list(n = 1), source = "MyGene")
#> $ok
#> [1] TRUE
#>
#> $status
#> [1] "ok"
#>
#> $http
#> [1] 200
#>
#> $data
#> $data$n
#> [1] 1
#>
#>
#> $source
#> [1] "MyGene"
#>
#> $error
#> NULL
#>
#> $detail
#> NULL
#>
#> $ts
#> [1] "2026-08-01 08:56:27 UTC"
#>
status_no_data(source = "gnomAD", http = 404L)
#> $ok
#> [1] FALSE
#>
#> $status
#> [1] "no_data"
#>
#> $http
#> [1] 404
#>
#> $data
#> NULL
#>
#> $source
#> [1] "gnomAD"
#>
#> $error
#> [1] "No gnomAD data was found for this query."
#>
#> $detail
#> NULL
#>
#> $ts
#> [1] "2026-08-01 08:56:27 UTC"
#>
status_skipped(source = "gnomAD", detail = "gnomad.broadinstitute.org open")
#> $ok
#> [1] FALSE
#>
#> $status
#> [1] "skipped"
#>
#> $http
#> [1] NA
#>
#> $data
#> NULL
#>
#> $source
#> [1] "gnomAD"
#>
#> $error
#> [1] "gnomAD was skipped (host temporarily unreachable)."
#>
#> $detail
#> [1] "gnomad.broadinstitute.org open"
#>
#> $ts
#> [1] "2026-08-01 08:56:27 UTC"
#>