diff --git a/lib/src/error.rs b/lib/src/error.rs index e58f178..a7bd74b 100644 --- a/lib/src/error.rs +++ b/lib/src/error.rs @@ -25,6 +25,14 @@ pub enum CriticalError { #[diagnostic(code(watchexec::runtime::exit))] Exit, + /// For custom critical errors. + /// + /// This should be used for errors by external code which are not covered by the other error + /// types; watchexec-internal errors should never use this. + #[error("external(critical): {0}")] + #[diagnostic(code(watchexec::critical::external))] + External(#[from] Box), + /// A critical I/O error occurred. #[error(transparent)] #[diagnostic(code(watchexec::critical::io_error))] @@ -63,6 +71,14 @@ pub enum RuntimeError { #[diagnostic(code(watchexec::runtime::exit))] Exit, + /// For custom runtime errors. + /// + /// This should be used for errors by external code which are not covered by the other error + /// types; watchexec-internal errors should never use this. + #[error("external(runtime): {0}")] + #[diagnostic(code(watchexec::runtime::external))] + External(#[from] Box), + /// Generic I/O error, with no additional context. #[error(transparent)] #[diagnostic(code(watchexec::runtime::io_error))]