From 2ca454b402d48c1808f8233c5adedc11b714c63c Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Sun, 15 Aug 2021 13:29:19 +0200 Subject: 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 ... --- ext/webgpu/shader.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'ext/webgpu/shader.rs') diff --git a/ext/webgpu/shader.rs b/ext/webgpu/shader.rs index f48411969..bd3b03f55 100644 --- a/ext/webgpu/shader.rs +++ b/ext/webgpu/shader.rs @@ -1,6 +1,5 @@ // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. -use deno_core::error::bad_resource_id; use deno_core::error::null_opbuf; use deno_core::error::AnyError; use deno_core::ResourceId; @@ -35,8 +34,7 @@ pub fn op_webgpu_create_shader_module( let instance = state.borrow::(); let device_resource = state .resource_table - .get::(args.device_rid) - .ok_or_else(bad_resource_id)?; + .get::(args.device_rid)?; let device = device_resource.0; let source = match args.code { -- cgit v1.2.3