For instance, I get this in my browser:
Error] panicked at 'wgpu error: Validation Error
Caused by:
In Device::create_render_pipeline
Color state [0] is invalid
Format Rgba8UnormSrgb can't be multisampled
', /home/jp/.cargo/git/checkouts/wgpu-b5b0e12eef369ba9/de497ae/wgpu/src/backend/direct.rs:3019:5
The error message is pretty good, but I would prefer to get an Err instead of a panic.
Here is the code from wgpu/src/backend/direct.rs:
#[track_caller]
fn handle_error_fatal(
&self,
cause: impl Error + Send + Sync + 'static,
operation: &'static str,
) -> ! {
panic!("Error in {operation}: {f}", f = self.format_error(&cause));
}
This is not a big problem; if returning a Result would be extremely annoying for some reason, then the current behavior is good enough, but usually it is bad manners for a library to panic when it could use Result instead.
For instance, I get this in my browser:
The error message is pretty good, but I would prefer to get an
Errinstead of a panic.Here is the code from
wgpu/src/backend/direct.rs:This is not a big problem; if returning a
Resultwould be extremely annoying for some reason, then the current behavior is good enough, but usually it is bad manners for a library to panic when it could useResultinstead.