Feature: Added proper IQ Stanza error handling #21

Merged
sha512sum merged 5 commits from feature/handling_stanza_errors into main 2024-12-24 06:11:48 +00:00
Member
No description provided.
sha512sum was assigned by Ivan-lis 2024-12-19 20:03:49 +00:00
Ivan-lis added 4 commits 2024-12-19 20:03:50 +00:00
Ivan-lis added this to the Main project 2024-12-19 20:03:51 +00:00
Ivan-lis added a new dependency 2024-12-19 20:04:18 +00:00
sha512sum requested changes 2024-12-20 12:45:26 +00:00
Dismissed
@ -0,0 +7,4 @@
namespace larra::xmpp::iq::error {
namespace impl {
Owner

Why impl

Why impl
Author
Member

forgot to remove from earlier implementation

forgot to remove from earlier implementation
sha512sum marked this conversation as resolved
@ -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>,
Owner

The check doesn't seem to work.

The check doesn't seem to work.
Author
Member

typo in is_same 2nd arg. Fixed and checked.
image

typo in is_same 2nd arg. Fixed and checked. ![image](/attachments/0f2c0540-a41f-4232-b992-b68d431eabba)
sha512sum marked this conversation as resolved
sha512sum requested changes 2024-12-21 14:54:41 +00:00
Dismissed
@ -0,0 +5,4 @@
#include <optional>
#include <variant>
namespace larra::xmpp::iq::error {
Owner

Stanza errors. Not iq errors

Stanza errors. Not iq errors
Ivan-lis marked this conversation as resolved
@ -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);
Owner

Why exception ?

Why exception ?
Author
Member

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)

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)
Owner

The second reason, yes, I didn't think of it right away. Then you need to set a normal exception type, not std::string

The second reason, yes, I didn't think of it right away. Then you need to set a normal exception type, not std::string
Author
Member

Fixed, thanks

Fixed, thanks
Ivan-lis marked this conversation as resolved
Ivan-lis added 1 commit 2024-12-22 22:45:07 +00:00
Renamed iq to stanza error. Added log level as cmake param
Some checks failed
PR Check / on-push-commit-check (push) Has been cancelled
5c77e3f4e9
Ivan-lis force-pushed feature/handling_stanza_errors from 5c77e3f4e9 to 284250a69f 2024-12-22 22:54:18 +00:00 Compare
Ivan-lis force-pushed feature/handling_stanza_errors from 284250a69f to c49a1cc514 2024-12-23 13:58:26 +00:00 Compare
Ivan-lis force-pushed feature/handling_stanza_errors from c49a1cc514 to 88609274ba 2024-12-23 14:13:06 +00:00 Compare
Ivan-lis force-pushed feature/handling_stanza_errors from 88609274ba to 0e37be8c62 2024-12-23 14:31:29 +00:00 Compare
Ivan-lis force-pushed feature/handling_stanza_errors from 0e37be8c62 to 6c7d43916c 2024-12-23 14:43:01 +00:00 Compare
sha512sum requested changes 2024-12-23 15:17:38 +00:00
Dismissed
@ -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>
Owner

Maybe it would be better to move the templates from here to the () operators?

Maybe it would be better to move the templates from here to the () operators?
Ivan-lis marked this conversation as resolved
Ivan-lis force-pushed feature/handling_stanza_errors from 6c7d43916c to 1834696290 2024-12-23 21:10:43 +00:00 Compare
sha512sum approved these changes 2024-12-24 06:05:11 +00:00
sha512sum force-pushed feature/handling_stanza_errors from 1834696290 to b908baf794 2024-12-24 06:09:41 +00:00 Compare
sha512sum merged commit b908baf794 into main 2024-12-24 06:11:48 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference: Larra/larra#21
No description provided.