Returning incorrect result in `handle_event` results in silent error
Hi!
I discovered today something that caught me quite off-guard and which I find quite error-prone: if one returns, for instance, state, or "hello" instead of {:ok, state} in their implementation of handle_element, no error is raised.
I checked the documentation:
https://github.com/qcam/saxy/blob/dce77bfd4664f1ab90f76d3c847224dbbfabe820/lib/saxy/handler.ex#L15C1-L22C34
Returning
{:ok, new_state}continues the parsing process with the new state.Returning
{:stop, anything}stops the prosing process immediately, andanythingwill be returned. This is usually handy when we want to get the desired return without parsing the whole file.Returning
{:halt, anything}stops the prosing process immediately,anythingwill be returned, together with the rest of buffer being parsed. This is usually handy when we want to get the desired return without parsing the whole file.
I have no idea at this point if this is easy to fix or not!
Re-reading my issue, I realise this may be done on purpose, yet I'm concerned that just bogusly returning state instead of {:ok, state} could result into very incorrect programs, and would prefer an error here.
I'll close for now!