Return no data error as atom instead of string

This commit is contained in:
Shadowfacts 2022-04-18 18:26:41 -04:00
parent 129061448a
commit 3a2145dfdd
1 changed files with 2 additions and 2 deletions

View File

@ -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