Maybe I'm missing something, but is there a way to stop parsing with a :error tuple which is directly passed through as the overall result?
I'm using Saxy for writing an RDF/XML parser which imposes some further restrictions on a valid document. So, I'd like to return a :error tuple in the event handlers when encountering an error, which I'd expect to be passed through directly as the result of Saxy.parse_string/3, but currently this results in this:
{:error,
%Saxy.ParseError{
__exception__: true,
binary: nil,
position: nil,
reason: {:bad_return, {:start_element, {:error, "my custom error"}}}
}
}
}
I'm aware of the :halt and :stop return patterns, which could be used for this scenario of course, but neither of them feels quite right:
- with
:stop the :error tuple is wrapped in a :ok tuple
- with
:halt the :error tuple is wrapped in a three element :halt tuple
What do you think of supporting :error tuples as an additional return pattern in the handlers, which will become the result of Saxy.parse_string/3 directly?
Maybe I'm missing something, but is there a way to stop parsing with a
:errortuple which is directly passed through as the overall result?I'm using Saxy for writing an RDF/XML parser which imposes some further restrictions on a valid document. So, I'd like to return a
:errortuple in the event handlers when encountering an error, which I'd expect to be passed through directly as the result ofSaxy.parse_string/3, but currently this results in this:I'm aware of the
:haltand:stopreturn patterns, which could be used for this scenario of course, but neither of them feels quite right::stopthe:errortuple is wrapped in a:oktuple:haltthe:errortuple is wrapped in a three element:halttupleWhat do you think of supporting
:errortuples as an additional return pattern in the handlers, which will become the result ofSaxy.parse_string/3directly?