Skip to content

Line-wrap warning and error messages from the API #119

@brookslogan

Description

@brookslogan

Warnings and error messages forwarded from the API aren't line-wrapped and could look better.

library(epidatr)
issue_data =
  covidcast(
    data_source = "hhs", signal = "confirmed_admissions_influenza_1d",
    geo_type = "state", time_type = "day",
    geo_values = c("az","ga"),
    # all `time_value`s:
    time_values = epirange(20221201, 20221231),
    # all issues through the analysis issue
    issues = epirange(20230101, 20230102)
  ) %>%
  fetch()
#> Warning: No API key found. You will be limited to non-complex queries and encounter rate
#> limits if you proceed.
#> To avoid this, you can get your key [here] and then:
#> ℹ set the environment variable DELPHI_EPIDATA_KEY
#> ℹ set the option 'delphi.epidata.key'
#> 
#> To save your key for later sessions (and hide it from your code), you can edit
#> your .Renviron file with:
#> ℹ usethis::edit_r_environ()
#> This warning is displayed once every 8 hours.
#> Warning: epidata warning: This request exceeded the anonymous limit on selected multiples, which will be enforced starting 2023-06-21. To be exempt from this limit, authenticate your requests with a free API key, now available at https://api.delphi.cmu.edu/epidata/admin/registration_form. A temporary public key `TEMP-API-KEY-EXPIRES-2023-06-28` is available for use between now and 2023-06-28 to give you time to register or adapt your requests without this message continuing to break your systems.

Created on 2023-06-05 with reprex v2.0.2 but altered to show that we're not actually wrapping the message.

We might be able to use cli for this, but need to be careful not to use the message directly as a cli format string. (I vaguely recall fiddling with this and using the brace syntax for gluing in a string and it not doing the line wrapping though, but my memory could be bad. There might be some special cli/glue thing to enable the line wrap on interpolated strings. Or we have some internal helpers in epiprocess for line wrapping, but that's sort of backwards progress.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions