summaryrefslogtreecommitdiffstats
path: root/lib/cepis/errors.rb
Commit message (Collapse)AuthorAgeFilesLines
* Expose the band of a CEP that does not existHEADv0.2.0mainMurilo Ijanc2026-07-271-1/+19
| | | | | | | | | | | | | | | | | | | | | A CEP that fails a lookup is rarely a random number: it is someone who knows the city and guessed the digits, most often the -000 that 957 municipalities never received. The API now answers that 404 with an optional faixa naming the municipality those numbers belong to, so the caller can say "not found, but you seem to be looking at Areal/RJ" instead of just "not found". It stays an error. Faixa hangs off CEPNotFound and nothing about it promotes a nonexistent CEP into an address. Its cep_ini/cep_fim are the smallest and largest CEP that really exist there, not the published bounds — the DNE's own start for Areal is the CEP that just failed — and the band is sparse, which is what ceps is for; both facts are spelled out in the docs so nobody iterates the pair. Parsing is deliberately toothless: a missing, empty or malformed faixa, or a 404 body that is not JSON at all, all yield nil. Losing the consolation prize must never replace a clean not-found with a parse failure.
* Initial importv0.1.0Murilo Ijanc2026-07-261-0/+67