Return no data error as atom instead of string

master
Shadowfacts 10 months ago
parent 129061448a
commit 3a2145dfdd

@ -22,11 +22,11 @@ defmodule FeedParser do
An extended set of parsers may also be provided, otherwise the default set (supporting RSS 2.0, Atom, JSON Feed, and RSS-in-JSON) will be used. Parsers are modules that implement the `FeedParser.Parser` behaviour.
"""
@spec parse(data :: String.t(), content_type :: String.t(), parsers :: [module()]) ::
{:ok, feed :: FeedParser.Feed.t()} | {:error, reason :: String.t()}
{:ok, feed :: FeedParser.Feed.t()} | {:error, reason :: term()}
def parse(data, content_type, parsers \\ @default_parsers)
def parse(nil, _, _) do
{:error, "no data"}
{:error, :no_data}
end
def parse(data, content_type, parsers) when is_binary(data) do

Loading…
Cancel
Save