diff --git a/lib/rdf/iri.ex b/lib/rdf/iri.ex index 3d4e5ed..8633127 100644 --- a/lib/rdf/iri.ex +++ b/lib/rdf/iri.ex @@ -97,11 +97,9 @@ defmodule RDF.IRI do def absolute?(%URI{scheme: nil}), do: false def absolute?(%URI{scheme: _}), do: true def absolute?(qname) when is_atom(qname) and not qname in [nil, true, false] do - try do - qname |> Namespace.resolve_term |> absolute?() - rescue - _ -> false - end + qname |> Namespace.resolve_term |> absolute?() + rescue + _ -> false end def absolute?(_), do: false diff --git a/lib/rdf/serialization/serialization.ex b/lib/rdf/serialization/serialization.ex index d7be716..ad03d64 100644 --- a/lib/rdf/serialization/serialization.ex +++ b/lib/rdf/serialization/serialization.ex @@ -55,13 +55,11 @@ defmodule RDF.Serialization do def format(name) def format(name) when is_binary(name) do - try do - name - |> String.to_existing_atom - |> format() - rescue - ArgumentError -> nil - end + name + |> String.to_existing_atom + |> format() + rescue + ArgumentError -> nil end def format(name) do diff --git a/lib/rdf/serializations/turtle_decoder.ex b/lib/rdf/serializations/turtle_decoder.ex index 1e5df64..e498a81 100644 --- a/lib/rdf/serializations/turtle_decoder.ex +++ b/lib/rdf/serializations/turtle_decoder.ex @@ -46,22 +46,20 @@ defmodule RDF.Turtle.Decoder do def parse(tokens), do: tokens |> :turtle_parser.parse defp build_graph(ast, base) do - try do - {graph, _} = - Enum.reduce ast, {RDF.Graph.new, %State{base_iri: base}}, fn - {:triples, triples_ast}, {graph, state} -> - with {statements, state} = triples(triples_ast, state) do - {RDF.Graph.add(graph, statements), state} - end + {graph, _} = + Enum.reduce ast, {RDF.Graph.new, %State{base_iri: base}}, fn + {:triples, triples_ast}, {graph, state} -> + with {statements, state} = triples(triples_ast, state) do + {RDF.Graph.add(graph, statements), state} + end - {:directive, directive_ast}, {graph, state} -> - {graph, directive(directive_ast, state)} + {:directive, directive_ast}, {graph, state} -> + {graph, directive(directive_ast, state)} - end - {:ok, graph} - rescue - error -> {:error, Exception.message(error)} - end + end + {:ok, graph} + rescue + error -> {:error, Exception.message(error)} end defp directive({:prefix, {:prefix_ns, _, ns}, iri}, state) do