From 0ba0ae5b4e2e57db61e415bfa40a6fde5f866295 Mon Sep 17 00:00:00 2001 From: Francis Bouvier Date: Mon, 27 Nov 2023 16:44:26 +0100 Subject: [PATCH] dom_exception: adapt to interface definition change Signed-off-by: Francis Bouvier --- src/dom/exceptions.zig | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/dom/exceptions.zig b/src/dom/exceptions.zig index dfb3fdcf..32792d86 100644 --- a/src/dom/exceptions.zig +++ b/src/dom/exceptions.zig @@ -44,9 +44,10 @@ pub const DOMException = struct { pub const _DATA_CLONE_ERR = 25; // TODO: deinit - pub fn init(alloc: std.mem.Allocator, err: parser.DOMError, callerName: []const u8) anyerror!DOMException { - const errName = DOMException.name(err); - const str = switch (err) { + pub fn init(alloc: std.mem.Allocator, err: anyerror, callerName: []const u8) anyerror!DOMException { + const errCast = @as(parser.DOMError, @errSetCast(err)); + const errName = DOMException.name(errCast); + const str = switch (errCast) { error.HierarchyRequest => try allocPrint( alloc, "{s}: Failed to execute '{s}' on 'Node': The new child element contains the parent.", @@ -55,7 +56,7 @@ pub const DOMException = struct { error.NoError => unreachable, else => "", // TODO: implement other messages }; - return .{ .err = err, .str = str }; + return .{ .err = errCast, .str = str }; } fn name(err: parser.DOMError) []const u8 {