pub enum ProcError {
Show 14 variants
ProcessNotFound(String),
NameNotFound {
name: String,
in_command_line: usize,
},
FilteredOut {
target: String,
reason: String,
},
PortNotFound(u16),
PermissionDenied(u32),
InvalidInput(String),
ConfirmationRequired {
message: String,
processes: Vec<Process>,
not_found: Option<Vec<String>>,
},
SystemError(String),
Timeout(String),
ParseError(String),
NotSupported(String),
ProcessGone(u32),
SignalError(String),
Reported {
message: String,
exit_code: ExitCode,
},
}Expand description
Main error type for proc operations
Variants§
ProcessNotFound(String)
No process found matching the given target
NameNotFound
No process has this name, but some have it in their command line, which
--cmd would match
Fields
FilteredOut
A target exists but --in or --by ruled out everything it matched.
The target sits in the quotes and the reason follows them.
Fields
PortNotFound(u16)
No process is listening on the specified port
PermissionDenied(u32)
Insufficient permissions to operate on the process
InvalidInput(String)
User provided invalid input or arguments
ConfirmationRequired
A command that changes processes was run without --yes where nobody
can be asked (--json, or no terminal). Carries the processes it would
have changed so --json callers can see them in the error.
Not shown as invalid input: the call is valid, it only needs a yes, and
the JSON reason (needs_confirmation) says so.
Fields
SystemError(String)
An underlying system call failed
Timeout(String)
The operation exceeded the allowed time limit
ParseError(String)
Failed to parse input or system output
NotSupported(String)
Feature is not available on the current platform
ProcessGone(u32)
The target process terminated during the operation
SignalError(String)
Failed to send a signal to the process
Reported
The command already printed its result, but the operation did not fully
succeed (some processes failed, a port stayed busy, a wait timed out).
main exits with exit_code without printing anything further.
Implementations§
Source§impl ProcError
impl ProcError
Sourcepub fn command_line_hint(&self) -> Option<String>
pub fn command_line_hint(&self) -> Option<String>
The --cmd hint, when this error carries one
Sourcepub fn reason(&self) -> Option<&'static str>
pub fn reason(&self) -> Option<&'static str>
Why this error is exit 4 (nothing was done), as the reason of the JSON
error. None for every error with another exit code.
Sourcepub fn name_not_found(name: &str, in_command_line: usize) -> Self
pub fn name_not_found(name: &str, in_command_line: usize) -> Self
The error for a name that matched no process: ProcError::NameNotFound
when in_command_line processes have it in their command line (which
--cmd would match), ProcError::ProcessNotFound when none do.
Trait Implementations§
Source§impl Error for ProcError
impl Error for ProcError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()