Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. GPUDevice
  4. popErrorScope()

GPUDevice: popErrorScope() method

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.

Note: This feature is available inWeb Workers.

ThepopErrorScope() method of theGPUDevice interface pops an existing GPU error scope from the error scope stack (originally pushed usingGPUDevice.pushErrorScope()) and returns aPromise that resolves to an object describing the first error captured in the scope, ornull if no error occurred.

Syntax

js
popErrorScope()

Parameters

None.

Return value

APromise that resolves to an object describing the first error captured in the scope. This can be of type:

If no error occurred, it resolves tonull.

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) {    sampler = null;    console.error(`An error occurred while creating sampler: ${error.message}`);  }});

SeeWebGPU Error Handling best practices for a lot more examples and information.

Specifications

Specification
WebGPU
# dom-gpudevice-poperrorscope

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp