Module io.smallrye.common.process
Package io.smallrye.common.process
Class ProcessExecutionException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
io.smallrye.common.process.AbstractExecutionException
io.smallrye.common.process.ProcessExecutionException
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
AbnormalExitException
An exception in the execution of a single process.
If this is due to a single problem, that problem will be recorded as the cause.
Otherwise, the list of problems will be recorded as suppressed exceptions.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a newProcessExecutionExceptioninstance.Constructs a newProcessExecutionExceptioninstance with an initial message.ProcessExecutionException(String msg, Throwable cause) Constructs a newProcessExecutionExceptioninstance with an initial message and cause.Constructs a newProcessExecutionExceptioninstance with an initial cause. -
Method Summary
Modifier and TypeMethodDescriptionReturns the arguments of the failed process (notnull).command()Returns the command of the failed process, ornullif it is unset.Render this exception to the given string builder.longpid()Returns the process ID of the failed process, or-1if it is unknown or if the process failed to start.voidsetArguments(List<String> arguments) Set the arguments of the failed process.voidsetCommand(Path command) Set the command of the failed process.voidsetPid(long pid) Set the process ID of the failed process.voidsetShowCommand(boolean showCommand) Indicate whether the command and arguments should be shown in the exception message.booleanReturnstrueif the command and arguments should be shown in the exception message.Methods inherited from class io.smallrye.common.process.AbstractExecutionException
getMessageMethods inherited from class java.lang.Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
ProcessExecutionException
public ProcessExecutionException()Constructs a newProcessExecutionExceptioninstance. The message is left blank (null), and no cause is specified. -
ProcessExecutionException
Constructs a newProcessExecutionExceptioninstance with an initial message. No cause is specified.- Parameters:
msg- the message
-
ProcessExecutionException
Constructs a newProcessExecutionExceptioninstance with an initial cause. If a non-nullcause is specified, its message is used to initialize the message of thisProcessExecutionException; otherwise the message is left blank (null).- Parameters:
cause- the cause
-
ProcessExecutionException
Constructs a newProcessExecutionExceptioninstance with an initial message and cause.- Parameters:
msg- the messagecause- the cause
-
-
Method Details
-
pid
public long pid()Returns the process ID of the failed process, or-1if it is unknown or if the process failed to start.- Returns:
- the process ID of the failed process, or
-1if it is unknown or if the process failed to start
-
setPid
public void setPid(long pid) Set the process ID of the failed process.- Parameters:
pid- the process ID of the failed process
-
command
Returns the command of the failed process, ornullif it is unset.- Returns:
- the command of the failed process, or
nullif it is unset
-
setCommand
Set the command of the failed process.- Parameters:
command- the command of the failed process (must not benull)
-
arguments
Returns the arguments of the failed process (notnull). The returned list is immutable.- Returns:
- the arguments of the failed process (not
null)
-
setArguments
Set the arguments of the failed process.- Parameters:
arguments- the arguments of the failed process (must not benull)
-
showCommand
public boolean showCommand()Returnstrueif the command and arguments should be shown in the exception message.- Returns:
trueif the command and arguments should be shown in the exception message
-
setShowCommand
public void setShowCommand(boolean showCommand) Indicate whether the command and arguments should be shown in the exception message.- Parameters:
showCommand-trueto show the command and arguments
-
getMessage
Description copied from class:AbstractExecutionExceptionRender this exception to the given string builder.- Overrides:
getMessagein classAbstractExecutionException- Parameters:
sb- the string builder (must not benull)- Returns:
- the same string builder (not
null)
-