Add error variants for external custom errors
This commit is contained in:
parent
81bee9513d
commit
3dff065f4b
|
@ -25,6 +25,14 @@ pub enum CriticalError {
|
||||||
#[diagnostic(code(watchexec::runtime::exit))]
|
#[diagnostic(code(watchexec::runtime::exit))]
|
||||||
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<dyn std::error::Error + Send + Sync>),
|
||||||
|
|
||||||
/// A critical I/O error occurred.
|
/// A critical I/O error occurred.
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
#[diagnostic(code(watchexec::critical::io_error))]
|
#[diagnostic(code(watchexec::critical::io_error))]
|
||||||
|
@ -63,6 +71,14 @@ pub enum RuntimeError {
|
||||||
#[diagnostic(code(watchexec::runtime::exit))]
|
#[diagnostic(code(watchexec::runtime::exit))]
|
||||||
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<dyn std::error::Error + Send + Sync>),
|
||||||
|
|
||||||
/// Generic I/O error, with no additional context.
|
/// Generic I/O error, with no additional context.
|
||||||
#[error(transparent)]
|
#[error(transparent)]
|
||||||
#[diagnostic(code(watchexec::runtime::io_error))]
|
#[diagnostic(code(watchexec::runtime::io_error))]
|
||||||
|
|
Loading…
Reference in New Issue