Non-Blocking Error Check Example

From ElixirBlocks
Jump to: navigation, search

Example of error checking using the ElixirRss module.


def fetch_and_parse(rss) do
  case ElixirRes.fetch_and_parse(rss) do
    {:ok, _response} = out ->
      out

    {:error, _} = err ->
      err
  end
rescue
  e ->
    dbg(e)
    {:error, :unknown} 
end