GPUValidationError - Web APIs | MDN

Constructor

GPUValidationError()

Creates a new GPUValidationError object instance.

Instance properties

The message property is inherited from its parent, GPUError:

message Experimental 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

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.