summaryrefslogtreecommitdiffstats
path: root/lib/cepis/error.ex
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cepis/error.ex')
-rw-r--r--lib/cepis/error.ex12
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/cepis/error.ex b/lib/cepis/error.ex
index bd86b65..2391c8c 100644
--- a/lib/cepis/error.ex
+++ b/lib/cepis/error.ex
@@ -21,11 +21,19 @@ defmodule Cepis.NotFoundError do
`cep` holds the normalised 8 digits that were looked up. Retrying does not
help: the answer is definitive.
+
+ `faixa` is a `Cepis.Faixa` naming the municipality that CEP *would* have
+ belonged to, or `nil`. It is context for the failure and **not** an address —
+ this is still a not-found, and the CEP is still not in the database. It is
+ `nil` whenever the number falls in a band no municipality owns, which the API
+ signals by omitting the field rather than sending null.
"""
- defexception [:message, :cep]
+ alias Cepis.Faixa
+
+ defexception [:message, :cep, :faixa]
- @type t :: %__MODULE__{message: String.t(), cep: String.t()}
+ @type t :: %__MODULE__{message: String.t(), cep: String.t(), faixa: Faixa.t() | nil}
end
defmodule Cepis.NetworkError do