From 9599ba5f9e4724d488c2791143f6c1406f5de016 Mon Sep 17 00:00:00 2001 From: Marco Zanon Date: Fri, 11 Jul 2025 12:00:24 +0200 Subject: [PATCH] Add type to Item tagged union to enable decoding of session object --- src/crash/sentry_envelope.zig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/crash/sentry_envelope.zig b/src/crash/sentry_envelope.zig index ab195bd42..c12ff5a01 100644 --- a/src/crash/sentry_envelope.zig +++ b/src/crash/sentry_envelope.zig @@ -278,6 +278,7 @@ pub const ItemType = enum { pub const Item = union(enum) { encoded: EncodedItem, attachment: Attachment, + session: Session, /// Convert the item to an encoded item. This modify the item /// in place. @@ -288,6 +289,7 @@ pub const Item = union(enum) { const result: EncodedItem = switch (self.*) { .encoded => |v| return v, .attachment => |*v| try v.encode(alloc), + .session => |*v| try v.encode(alloc), }; self.* = .{ .encoded = result }; return result; @@ -299,6 +301,7 @@ pub const Item = union(enum) { return switch (self) { .encoded => |v| v.type, .attachment => .attachment, + .session => .session, }; } @@ -335,6 +338,10 @@ pub const Item = union(enum) { alloc, encoded, ) }, + .session => .{ .session = try .decode( + alloc, + encoded, + ) }, else => return error.UnsupportedType, }; }