files/en-us/web/api/gpuuncapturederrorevent/index.md
{{APIRef("WebGPU API")}}{{SecureContext_Header}}{{AvailableInWorkers}}
The GPUUncapturedErrorEvent interface of the {{domxref("WebGPU API", "WebGPU API", "", "nocode")}} is the event object type for the {{domxref("GPUDevice")}} {{domxref("GPUDevice.uncapturederror_event", "uncapturederror")}} event, used for telemetry and to report unexpected errors.
Known error cases should be handled using {{domxref("GPUDevice.pushErrorScope", "pushErrorScope()")}} and {{domxref("GPUDevice.popErrorScope", "popErrorScope()")}}.
{{InheritanceDiagram}}
GPUUncapturedErrorEvent object instance.Inherits properties from its parent, {{domxref("Event")}}.
You could use something like the following as a global mechanism to pick up any errors that aren't handled by error scopes and capture them.
// …
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,
});
});
// …
{{Specifications}}
{{Compat}}