Feature: Added proper IQ Stanza error handling #21
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/handling_stanza_errors"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
@ -0,0 +7,4 @@
namespace larra::xmpp::iq::error {
namespace impl {
Why impl
forgot to remove from earlier implementation
@ -0,0 +146,4 @@
impl::UnexpectedRequest,
impl::UnknownIqError>;
static_assert(!std::is_same_v<typename std::variant_alternative_t<std::variant_size_v<IqError> - 1, IqError>, IqError>,
The check doesn't seem to work.
typo in is_same 2nd arg. Fixed and checked.
@ -0,0 +5,4 @@
#include <optional>
#include <variant>
namespace larra::xmpp::iq::error {
Stanza errors. Not iq errors
@ -0,0 +87,4 @@
return TryParse(element).value();
}
friend constexpr auto operator<<(xmlpp::Element* element, const UnknownIqError& obj) -> void {
throw std::format("'{}' must never be written into the real stream!", kErrorMessage);
Why exception ?
For now we use larra lib only for client impl and this operator should never be called. Maybe I can just add TODO to throw error only if app is a client?
Another reason - I don't want to write invalid xml stream ('UnknownIqError ' doesn't exists)
The second reason, yes, I didn't think of it right away. Then you need to set a normal exception type, not std::string
Fixed, thanks
5c77e3f4e9
to284250a69f
284250a69f
toc49a1cc514
c49a1cc514
to88609274ba
88609274ba
to0e37be8c62
0e37be8c62
to6c7d43916c
@ -119,1 +124,3 @@
using Iq = std::variant<iq::Get<Payload>, iq::Set<Payload>, iq::Result<Payload>, iq::Error<Payload>>;
using Iq = std::variant<iq::Get<Payload>, iq::Set<Payload>, iq::Result<Payload>, IqError>;
template <typename Payload>
Maybe it would be better to move the templates from here to the () operators?
6c7d43916c
to1834696290
1834696290
tob908baf794