Sheetshow.CellError (Sheetshow v0.1.0)

Copy Markdown View Source

What a formula worked out to, when it did not work out.

iex> Sheetshow.CellError.new("DIVIDE_BY_ZERO", "Function DIVIDE parameter 2 cannot be zero.")
%Sheetshow.CellError{type: :divide_by_zero, message: "Function DIVIDE parameter 2 cannot be zero."}

These are never cell values. A cell holds what you would type into it (a number, a string, a formula), and #DIV/0! is not something you can type; it is what Sheets made of what you typed. So it arrives in a cell's meta under :effective, alongside :formatted, and Sheetshow.Value need never know it exists.

Summary

Functions

Builds one from what Google calls it. A type we do not know stays the string Google sent, rather than becoming an atom, because atoms are never collected and this comes off the wire.

Types

t()

@type t() :: %Sheetshow.CellError{
  message: String.t() | nil,
  type: atom() | String.t()
}

Functions

new(type, message \\ nil)

@spec new(String.t(), String.t() | nil) :: t()

Builds one from what Google calls it. A type we do not know stays the string Google sent, rather than becoming an atom, because atoms are never collected and this comes off the wire.

iex> Sheetshow.CellError.new("REF").type
:ref
iex> Sheetshow.CellError.new("SOMETHING_NEW").type
"SOMETHING_NEW"