move InvalidQueueId error variant to top level error types

This commit is contained in:
teoxoy 2024-06-21 18:05:37 +02:00 committed by Teodor Tanasoaia
parent 3005b46a29
commit ad2d797f81
2 changed files with 10 additions and 8 deletions

View File

@ -415,8 +415,6 @@ pub enum DeviceError {
ResourceCreationFailed, ResourceCreationFailed,
#[error("DeviceId is invalid")] #[error("DeviceId is invalid")]
InvalidDeviceId, InvalidDeviceId,
#[error("QueueId is invalid")]
InvalidQueueId,
#[error(transparent)] #[error(transparent)]
DeviceMismatch(#[from] Box<DeviceMismatch>), DeviceMismatch(#[from] Box<DeviceMismatch>),
} }

View File

@ -378,6 +378,8 @@ pub struct InvalidQueue;
#[derive(Clone, Debug, Error)] #[derive(Clone, Debug, Error)]
#[non_exhaustive] #[non_exhaustive]
pub enum QueueWriteError { pub enum QueueWriteError {
#[error("QueueId is invalid")]
InvalidQueueId,
#[error(transparent)] #[error(transparent)]
Queue(#[from] DeviceError), Queue(#[from] DeviceError),
#[error(transparent)] #[error(transparent)]
@ -391,6 +393,8 @@ pub enum QueueWriteError {
#[derive(Clone, Debug, Error)] #[derive(Clone, Debug, Error)]
#[non_exhaustive] #[non_exhaustive]
pub enum QueueSubmitError { pub enum QueueSubmitError {
#[error("QueueId is invalid")]
InvalidQueueId,
#[error(transparent)] #[error(transparent)]
Queue(#[from] DeviceError), Queue(#[from] DeviceError),
#[error(transparent)] #[error(transparent)]
@ -430,7 +434,7 @@ impl Global {
let queue = hub let queue = hub
.queues .queues
.get(queue_id) .get(queue_id)
.map_err(|_| DeviceError::InvalidQueueId)?; .map_err(|_| QueueWriteError::InvalidQueueId)?;
let device = queue.device.as_ref().unwrap(); let device = queue.device.as_ref().unwrap();
@ -499,7 +503,7 @@ impl Global {
let queue = hub let queue = hub
.queues .queues
.get(queue_id) .get(queue_id)
.map_err(|_| DeviceError::InvalidQueueId)?; .map_err(|_| QueueWriteError::InvalidQueueId)?;
let device = queue.device.as_ref().unwrap(); let device = queue.device.as_ref().unwrap();
@ -526,7 +530,7 @@ impl Global {
let queue = hub let queue = hub
.queues .queues
.get(queue_id) .get(queue_id)
.map_err(|_| DeviceError::InvalidQueueId)?; .map_err(|_| QueueWriteError::InvalidQueueId)?;
let device = queue.device.as_ref().unwrap(); let device = queue.device.as_ref().unwrap();
@ -695,7 +699,7 @@ impl Global {
let queue = hub let queue = hub
.queues .queues
.get(queue_id) .get(queue_id)
.map_err(|_| DeviceError::InvalidQueueId)?; .map_err(|_| QueueWriteError::InvalidQueueId)?;
let device = queue.device.as_ref().unwrap(); let device = queue.device.as_ref().unwrap();
@ -955,7 +959,7 @@ impl Global {
let queue = hub let queue = hub
.queues .queues
.get(queue_id) .get(queue_id)
.map_err(|_| DeviceError::InvalidQueueId)?; .map_err(|_| QueueWriteError::InvalidQueueId)?;
let device = queue.device.as_ref().unwrap(); let device = queue.device.as_ref().unwrap();
@ -1150,7 +1154,7 @@ impl Global {
let queue = hub let queue = hub
.queues .queues
.get(queue_id) .get(queue_id)
.map_err(|_| DeviceError::InvalidQueueId)?; .map_err(|_| QueueSubmitError::InvalidQueueId)?;
let device = queue.device.as_ref().unwrap(); let device = queue.device.as_ref().unwrap();