TaxJar.Requests.Error (tax_jar v0.1.0)

Context for representing an error response from the TaxJar API.

Summary

Functions

Build a new Error struct from the given reason.

Build a new Error struct from the given JSON response and code.

Types

@type t() :: %TaxJar.Requests.Error{
  decoded_response: map() | :none,
  message: binary() | nil,
  reason: term(),
  response: any() | :none,
  status: non_neg_integer() | :none
}

Functions

@spec new(reason :: any()) :: t()

Build a new Error struct from the given reason.

This is expected when the connection isn't successful.

Link to this function

new(response, status)

@spec new(response :: binary(), status :: integer()) :: t()

Build a new Error struct from the given JSON response and code.

It's expected that the response is well formatted JSON.