mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 08:18:59 +00:00
dom_exception: adapt to interface definition change
Signed-off-by: Francis Bouvier <francis@lightpanda.io>
This commit is contained in:
@@ -44,9 +44,10 @@ pub const DOMException = struct {
|
|||||||
pub const _DATA_CLONE_ERR = 25;
|
pub const _DATA_CLONE_ERR = 25;
|
||||||
|
|
||||||
// TODO: deinit
|
// TODO: deinit
|
||||||
pub fn init(alloc: std.mem.Allocator, err: parser.DOMError, callerName: []const u8) anyerror!DOMException {
|
pub fn init(alloc: std.mem.Allocator, err: anyerror, callerName: []const u8) anyerror!DOMException {
|
||||||
const errName = DOMException.name(err);
|
const errCast = @as(parser.DOMError, @errSetCast(err));
|
||||||
const str = switch (err) {
|
const errName = DOMException.name(errCast);
|
||||||
|
const str = switch (errCast) {
|
||||||
error.HierarchyRequest => try allocPrint(
|
error.HierarchyRequest => try allocPrint(
|
||||||
alloc,
|
alloc,
|
||||||
"{s}: Failed to execute '{s}' on 'Node': The new child element contains the parent.",
|
"{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,
|
error.NoError => unreachable,
|
||||||
else => "", // TODO: implement other messages
|
else => "", // TODO: implement other messages
|
||||||
};
|
};
|
||||||
return .{ .err = err, .str = str };
|
return .{ .err = errCast, .str = str };
|
||||||
}
|
}
|
||||||
|
|
||||||
fn name(err: parser.DOMError) []const u8 {
|
fn name(err: parser.DOMError) []const u8 {
|
||||||
|
|||||||
Reference in New Issue
Block a user