mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Fix returned error types in WebGPU
This commit is contained in:
parent
a751b1c3d7
commit
430248e9c8
3 changed files with 7 additions and 16 deletions
|
@ -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
|
||||
}
|
||||
|
@ -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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
@ -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),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -180,7 +180,7 @@ impl GPUDeviceMethods for GPUDevice {
|
|||
id,
|
||||
wgpu_descriptor,
|
||||
))
|
||||
.unwrap();
|
||||
.expect("Failed to create WebGPU buffer");
|
||||
} else {
|
||||
unimplemented!()
|
||||
};
|
||||
|
@ -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()];
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue