GPUUncapturedErrorEvent
注意:此功能在 Web Workers 中可用。
GPUUncapturedErrorEvent 介面是 WebGPU API 中的事件物件型別,用於 GPUDevice 的 uncapturederror 事件,用於遙測和報告意外錯誤。
已知錯誤情況應使用 pushErrorScope() 和 popErrorScope() 進行處理。
建構函式
GPUUncapturedErrorEvent()-
建立一個新的
GPUUncapturedErrorEvent物件例項。
例項屬性
繼承其父級 Event 的屬性。
示例
您可以使用類似以下的機制來捕獲未被錯誤範圍處理的任何錯誤。
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,
});
});
// …
規範
| 規範 |
|---|
| WebGPU # gpuuncapturederrorevent |
瀏覽器相容性
載入中…