CenterOnBudget / getcensus

Load American Community Survey data from the U.S. Census Bureau API into Stata
https://centeronbudget.github.io/getcensus/
MIT License
14 stars 3 forks source link

Expand list of possible reasons in error message after failed API call #37

Closed c-zippel closed 2 years ago

c-zippel commented 3 years ago

To include something like “X-year estimates are not available for the geography requested.” For instance, the following are valid calls but return no results as the requested geographies don’t meet the minimum population threshold for 1-year estimates: getcensus B19013, sample(1) geography(us) geocomp(90) clear getcensus B19013, sample(1) geography(county) statefips(36) countyfips(003) clear

I am sure there are other reasons to add too.

c-zippel commented 3 years ago

Another one: user asked for 1-year estimates but table is only published for 5-year, e.g., B99185

c-zippel commented 3 years ago

here's what I was thinking:

The Census Bureau API did not return data for `year'. This may have happened because:

  • Table ID or variable IDs are invalid or are not available for the requested year.
  • GEOIDs are invalid, or are not available for the requested sample and/or year.
  • Geographic components are not available for the requested sample and/or year, or could not be combined with (if specified) the requested state FIPS codes or GEOIDs.
  • API key is invalid.
  • Problems with your internet connection.

The 2nd and 3rd would appear only if geoids() or geocomponents() are specified, respectively.