FluuxIO / go-xmpp

Native Go XMPP library
https://www.process-one.net/
BSD 3-Clause "New" or "Revised" License
318 stars 63 forks source link

stanza.Err makes 'code' non-optional #170

Open ivucica opened 3 years ago

ivucica commented 3 years ago

Neither RFC3920 nor RFC6120 require the code attribute on <error/>, but the implementation of stanza.Err type makes it required, and silently so:

https://github.com/FluuxIO/go-xmpp/blob/947fcf0/stanza/error.go#L81-L83

That is: omitting code requires in the whole element silently not being marshalled.

The check for code==0 should merely result in the code attribute being omitted, not in the whole <error/> being omitted.