netsurf: add missing netsurf DOM errors

This commit is contained in:
Pierre Tachoire
2024-04-29 17:42:38 +02:00
parent 9f2bad7498
commit d155421a40
2 changed files with 25 additions and 0 deletions

View File

@@ -91,6 +91,12 @@ pub const DOMException = struct {
error.InvalidNodeType => "InvalidNodeTypeError", error.InvalidNodeType => "InvalidNodeTypeError",
error.DataClone => "DataCloneError", error.DataClone => "DataCloneError",
error.NoError => unreachable, error.NoError => unreachable,
// custom netsurf error
error.UnspecifiedEventType => "UnspecifiedEventTypeError",
error.DispatchRequest => "DispatchRequestError",
error.NoMemory => "NoMemoryError",
error.AttributeWrongType => "AttributeWrongTypeError",
}; };
} }
@@ -124,6 +130,12 @@ pub const DOMException = struct {
error.InvalidNodeType => 24, error.InvalidNodeType => 24,
error.DataClone => 25, error.DataClone => 25,
error.NoError => unreachable, error.NoError => unreachable,
// custom netsurf error
error.UnspecifiedEventType => 128,
error.DispatchRequest => 129,
error.NoMemory => 130,
error.AttributeWrongType => 131,
}; };
} }

View File

@@ -339,6 +339,12 @@ pub const DOMError = error{
Timeout, Timeout,
InvalidNodeType, InvalidNodeType,
DataClone, DataClone,
// custom netsurf error
UnspecifiedEventType,
DispatchRequest,
NoMemory,
AttributeWrongType,
}; };
const DOMException = c.dom_exception; const DOMException = c.dom_exception;
@@ -363,6 +369,13 @@ fn DOMErr(except: DOMException) DOMError!void {
c.DOM_INVALID_ACCESS_ERR => DOMError.InvalidAccess, c.DOM_INVALID_ACCESS_ERR => DOMError.InvalidAccess,
c.DOM_VALIDATION_ERR => DOMError.Validation, c.DOM_VALIDATION_ERR => DOMError.Validation,
c.DOM_TYPE_MISMATCH_ERR => DOMError.TypeMismatch, c.DOM_TYPE_MISMATCH_ERR => DOMError.TypeMismatch,
// custom netsurf error
c.DOM_UNSPECIFIED_EVENT_TYPE_ERR => DOMError.UnspecifiedEventType,
c.DOM_DISPATCH_REQUEST_ERR => DOMError.DispatchRequest,
c.DOM_NO_MEM_ERR => DOMError.NoMemory,
c.DOM_ATTR_WRONG_TYPE_ERR => DOMError.AttributeWrongType,
else => unreachable, else => unreachable,
}; };
} }