Skip to contents

Works out which status the failure is and asks status_message() for the wording, so it honours biohttp.status_message like everything else. Pass http for a response that arrived, or condition for a transport failure where none did.

Usage

http_error_message(source, http = NA_integer_, condition = NULL)

Arguments

source

A friendly label for the service, for example "gnomAD".

http

An HTTP status code, or NA_integer_ when no response arrived.

condition

A caught condition, used only when http is NA.

Value

A single string.

Examples

http_error_message("gnomAD", http = 404L)
#> [1] "No gnomAD data was found for this query."
http_error_message("gnomAD", http = 503L)
#> [1] "gnomAD is temporarily unavailable. Please try again."
http_error_message("gnomAD", condition = simpleError("Timeout was reached"))
#> [1] "gnomAD took too long to respond. Please try again."