GPUValidationError - Web APIs | MDN
Constructor
GPUValidationError()-
Creates a new
GPUValidationErrorobject instance.
Instance properties
The message property is inherited from its parent, GPUError:
messageExperimental Read only-
A string providing a human-readable message that explains why the error occurred.
Examples
The following example uses an error scope to capture a suspected validation error, logging it to the console.
js
device.pushErrorScope("validation");
let sampler = device.createSampler({
maxAnisotropy: 0, // Invalid, maxAnisotropy must be at least 1.
});
device.popErrorScope().then((error) => {
if (error) {
// error is a GPUValidationError object instance
sampler = null;
console.error(`An error occurred while creating sampler: ${error.message}`);
}
});
Specifications
| Specification |
|---|
| WebGPU # gpuvalidationerror |