GPUUncapturedErrorEvent
Khả dụng hạn chế
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Note: This feature is available in Web Workers.
Giao diện GPUUncapturedErrorEvent của WebGPU API là loại đối tượng sự kiện cho sự kiện GPUDevice uncapturederror, được sử dụng để đo lường và báo cáo các lỗi không mong đợi.
Các trường hợp lỗi đã biết nên được xử lý bằng pushErrorScope() và popErrorScope().
Hàm khởi tạo
GPUUncapturedErrorEvent()-
Tạo một phiên bản đối tượng
GPUUncapturedErrorEventmới.
Thuộc tính phiên bản
Kế thừa các thuộc tính từ thực thể cha, Event.
Ví dụ
Bạn có thể sử dụng thứ như sau như một cơ chế toàn cục để phát hiện các lỗi không được xử lý bởi error scopes và ghi lại chúng.
js
// …
device.addEventListener("uncapturederror", (event) => {
// Re-surface the error
console.error("A WebGPU error was not captured:", event.error.message);
reportErrorToServer({
type: event.error.constructor.name,
message: event.error.message,
});
});
// …
Thông số kỹ thuật
| Thông số kỹ thuật |
|---|
| WebGPU> # gpuuncapturederrorevent> |