Skip to content

Commit

Permalink
Add error kind to task error_type and add result own type
Browse files Browse the repository at this point in the history
  • Loading branch information
AlixANNERAUD committed Jun 27, 2024
1 parent 1a77c14 commit b479acc
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Modules/Task/src/Error.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,20 @@
use std::sync::PoisonError;

pub type Result<T> = std::result::Result<T, Error_type>;

#[derive(Debug, Clone)]
pub enum Error_type {
Invalid_task_identifier,
Failed_to_create_thread,
No_thread_for_task,
Failed_to_spawn_thread,
Poisoned_lock,
Invalid_environment_variable,
Too_many_tasks,
}

impl<T> From<PoisonError<T>> for Error_type {
fn from(_: PoisonError<T>) -> Self {
Error_type::Poisoned_lock
}
}

0 comments on commit b479acc

Please sign in to comment.