Skip to content

Commit

Permalink
Fix returned error types in WebGPU
Browse files Browse the repository at this point in the history
  • Loading branch information
Zakor Gyula committed Jan 13, 2020
1 parent a751b1c commit 430248e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
9 changes: 2 additions & 7 deletions components/script/dom/gpu.rs
Expand Up @@ -132,9 +132,7 @@ impl GPUMethods for GPU {
))
.is_err()
{
promise.reject_error(Error::Type(
"Failed to send adapter request to constellation...".to_owned(),
));
promise.reject_error(Error::Operation);
}
promise
}
Expand All @@ -153,10 +151,7 @@ impl AsyncWGPUListener for GPU {
);
promise.resolve_native(&adapter);
},
response => promise.reject_error(Error::Type(format!(
"Wrong response received for GPU from WebGPU thread {:?}",
response,
))),
_ => promise.reject_error(Error::Operation),
}
}
}
10 changes: 3 additions & 7 deletions components/script/dom/gpuadapter.rs
Expand Up @@ -102,12 +102,10 @@ impl GPUAdapterMethods for GPUAdapter {
.send(WebGPURequest::RequestDevice(sender, self.adapter, desc, id))
.is_err()
{
promise.reject_error(Error::Type(
"Failed to send RequestDevice message...".to_owned(),
));
promise.reject_error(Error::Operation);
}
} else {
promise.reject_error(Error::Type("No WebGPU thread...".to_owned()))
promise.reject_error(Error::Operation);
};
promise
}
Expand All @@ -127,9 +125,7 @@ impl AsyncWGPUListener for GPUAdapter {
);
promise.resolve_native(&device);
},
_ => promise.reject_error(Error::Type(
"Wrong response type from WebGPU thread...".to_owned(),
)),
_ => promise.reject_error(Error::Operation),
}
}
}
4 changes: 2 additions & 2 deletions components/script/dom/gpudevice.rs
Expand Up @@ -180,7 +180,7 @@ impl GPUDeviceMethods for GPUDevice {
id,
wgpu_descriptor,
))
.unwrap();
.expect("Failed to create WebGPU buffer");
} else {
unimplemented!()
};
Expand Down Expand Up @@ -218,7 +218,7 @@ impl GPUDeviceMethods for GPUDevice {
id,
wgpu_descriptor.clone(),
))
.unwrap()
.expect("Failed to create WebGPU buffer");
} else {
return vec![js_val.get()];
};
Expand Down

0 comments on commit 430248e

Please sign in to comment.