mirror of
https://github.com/spacedriveapp/spacedrive.git
synced 2026-04-22 15:40:07 -04:00
* First draft on task system usage, still missing job system * Scan location roughly working, a ton of stuff to fix yet * Updating some deps due to crashes and bugs * Exposing non critical errors to frontend * Getting active job reports from job system * Using boxed opaque type to avoid a downcast issue with generics * Task system issues discovered on race conditions * Enable debug * Fix job report in the job manager * Fix race condition on steal tasks * Fixed race condition on task suspend * Some fixes on job progress reporting and save * Fixed many race conditions and a hard deadlock Also some progress report polishing * Ignore .ts and .mts video files for now * Some better logs * bruh * Internal deadlocks and excess of communication in the task system - Also better logs * Bunch of fixes and optimizations * WIP at fixing file identifier * Fixed file identifier job - still need to work on its progress report frontend * A bunch of polishing * Fixed some bugs and did more polishing * Cleanup * Bridging old and new job systems * A ton of fixes * A bunch of bugs related to shutdown and resume * Indexer and watcher bugs * Log normalizing * Fixing CI * Change error! to warn! on non critical errors log * Fix redirect to new location * Type annotation * Bogus merge resolution on cargo lock
36 lines
1.5 KiB
Rust
36 lines
1.5 KiB
Rust
use std::{error::Error, fmt};
|
|
|
|
use super::task::{Task, TaskId};
|
|
|
|
/// Task system's error type definition, representing when internal errors occurs.
|
|
#[derive(Debug, thiserror::Error)]
|
|
pub enum SystemError {
|
|
#[error("task not found <task_id='{0}'>")]
|
|
TaskNotFound(TaskId),
|
|
#[error("task aborted <task_id='{0}'>")]
|
|
TaskAborted(TaskId),
|
|
#[error("task join error <task_id='{0}'>")]
|
|
TaskJoin(TaskId),
|
|
#[error("task timeout error <task_id='{0}'>")]
|
|
TaskTimeout(TaskId),
|
|
#[error("forced abortion for task <task_id='{0}'> timed out")]
|
|
TaskForcedAbortTimeout(TaskId),
|
|
}
|
|
|
|
/// Trait for errors that can be returned by tasks, we use this trait as a bound for the task system generic
|
|
/// error type.
|
|
///
|
|
///With this trait, we can have a unified error type through all the tasks in the system.
|
|
pub trait RunError: Error + fmt::Debug + Send + Sync + 'static {}
|
|
|
|
/// We provide a blanket implementation for all types that also implements
|
|
/// [`std::error::Error`](https://doc.rust-lang.org/std/error/trait.Error.html) and
|
|
/// [`std::fmt::Debug`](https://doc.rust-lang.org/std/fmt/trait.Debug.html).
|
|
/// So you will not need to implement this trait for your error type, just implement the `Error` and `Debug`
|
|
impl<T: Error + fmt::Debug + Send + Sync + 'static> RunError for T {}
|
|
|
|
/// A task system dispatcher error type, returning tasks when the task system has shutdown.
|
|
#[derive(Debug, thiserror::Error)]
|
|
#[error("task system already shutdown and can't dispatch more tasks: <tasks_count={}>", .0.len())]
|
|
pub struct DispatcherShutdownError<E: RunError>(pub Vec<Box<dyn Task<E>>>);
|