files/en-us/web/api/gpudevicelostinfo/index.md
{{APIRef("WebGPU API")}}{{SecureContext_Header}}{{AvailableInWorkers}}
The GPUDeviceLostInfo interface of the {{domxref("WebGPU API", "WebGPU API", "", "nocode")}} represents the object returned when the {{domxref("GPUDevice.lost")}} {{jsxref("Promise")}} resolves. This provides information as to why a device has been lost.
See the {{domxref("GPUDevice.lost")}} page for more information about "lost" state.
{{InheritanceDiagram}}
async function init() {
if (!navigator.gpu) {
throw Error("WebGPU not supported.");
}
const adapter = await navigator.gpu.requestAdapter();
if (!adapter) {
throw Error("Couldn't request WebGPU adapter.");
}
// Create a GPUDevice
let device = await adapter.requestDevice(descriptor);
// Use lost to handle lost devices
device.lost.then((info) => {
console.error(`WebGPU device was lost: ${info.message}`);
device = null;
if (info.reason !== "destroyed") {
init();
}
});
// …
}
{{Specifications}}
{{Compat}}