Skip to content

Commit d155421

Browse files
committed
netsurf: add missing netsurf DOM errors
1 parent 9f2bad7 commit d155421

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

src/dom/exceptions.zig

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ pub const DOMException = struct {
9191
error.InvalidNodeType => "InvalidNodeTypeError",
9292
error.DataClone => "DataCloneError",
9393
error.NoError => unreachable,
94+
95+
// custom netsurf error
96+
error.UnspecifiedEventType => "UnspecifiedEventTypeError",
97+
error.DispatchRequest => "DispatchRequestError",
98+
error.NoMemory => "NoMemoryError",
99+
error.AttributeWrongType => "AttributeWrongTypeError",
94100
};
95101
}
96102

@@ -124,6 +130,12 @@ pub const DOMException = struct {
124130
error.InvalidNodeType => 24,
125131
error.DataClone => 25,
126132
error.NoError => unreachable,
133+
134+
// custom netsurf error
135+
error.UnspecifiedEventType => 128,
136+
error.DispatchRequest => 129,
137+
error.NoMemory => 130,
138+
error.AttributeWrongType => 131,
127139
};
128140
}
129141

src/netsurf.zig

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,12 @@ pub const DOMError = error{
339339
Timeout,
340340
InvalidNodeType,
341341
DataClone,
342+
343+
// custom netsurf error
344+
UnspecifiedEventType,
345+
DispatchRequest,
346+
NoMemory,
347+
AttributeWrongType,
342348
};
343349

344350
const DOMException = c.dom_exception;
@@ -363,6 +369,13 @@ fn DOMErr(except: DOMException) DOMError!void {
363369
c.DOM_INVALID_ACCESS_ERR => DOMError.InvalidAccess,
364370
c.DOM_VALIDATION_ERR => DOMError.Validation,
365371
c.DOM_TYPE_MISMATCH_ERR => DOMError.TypeMismatch,
372+
373+
// custom netsurf error
374+
c.DOM_UNSPECIFIED_EVENT_TYPE_ERR => DOMError.UnspecifiedEventType,
375+
c.DOM_DISPATCH_REQUEST_ERR => DOMError.DispatchRequest,
376+
c.DOM_NO_MEM_ERR => DOMError.NoMemory,
377+
c.DOM_ATTR_WRONG_TYPE_ERR => DOMError.AttributeWrongType,
378+
366379
else => unreachable,
367380
};
368381
}

0 commit comments

Comments
 (0)