diff options
| author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2021-08-15 13:29:19 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-15 13:29:19 +0200 |
| commit | 2ca454b402d48c1808f8233c5adedc11b714c63c (patch) | |
| tree | 592f9e877e9b0ae92be80383ab723cc290e4b01e /ext/webgpu/texture.rs | |
| parent | 18ff6bb053d600c277613628a256fe5fdd4dda67 (diff) | |
refactor(ops): return BadResource errors in ResourceTable calls (#11710)
* refactor(ops): return BadResource errors in ResourceTable calls
Instead of relying on callers to map Options to Results via `.ok_or_else(bad_resource_id)` at over 176 different call sites ...
Diffstat (limited to 'ext/webgpu/texture.rs')
| -rw-r--r-- | ext/webgpu/texture.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/ext/webgpu/texture.rs b/ext/webgpu/texture.rs index 587ac46a7..4829811e2 100644 --- a/ext/webgpu/texture.rs +++ b/ext/webgpu/texture.rs @@ -1,7 +1,7 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. +use deno_core::error::not_supported; use deno_core::error::AnyError; -use deno_core::error::{bad_resource_id, not_supported}; use deno_core::ResourceId; use deno_core::{OpState, Resource}; use serde::Deserialize; @@ -149,8 +149,7 @@ pub fn op_webgpu_create_texture( let instance = state.borrow::<super::Instance>(); let device_resource = state .resource_table - .get::<super::WebGpuDevice>(args.device_rid) - .ok_or_else(bad_resource_id)?; + .get::<super::WebGpuDevice>(args.device_rid)?; let device = device_resource.0; let descriptor = wgpu_core::resource::TextureDescriptor { @@ -204,8 +203,7 @@ pub fn op_webgpu_create_texture_view( let instance = state.borrow::<super::Instance>(); let texture_resource = state .resource_table - .get::<WebGpuTexture>(args.texture_rid) - .ok_or_else(bad_resource_id)?; + .get::<WebGpuTexture>(args.texture_rid)?; let texture = texture_resource.0; let descriptor = wgpu_core::resource::TextureViewDescriptor { |
