You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Returning {:ok, new_state} continues the parsing process with the new state.
Returning {:stop, anything} stops the prosing process immediately, and anything will 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, anything will 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!
The text was updated successfully, but these errors were encountered:
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.
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 ofhandle_element
, no error is raised.I checked the documentation:
https://github.com/qcam/saxy/blob/dce77bfd4664f1ab90f76d3c847224dbbfabe820/lib/saxy/handler.ex#L15C1-L22C34
I have no idea at this point if this is easy to fix or not!
The text was updated successfully, but these errors were encountered: