Package org.zeroturnaround.exec
Class ProcessInitException
- java.lang.Object
-
- java.lang.Throwable
-
- java.lang.Exception
-
- java.io.IOException
-
- org.zeroturnaround.exec.ProcessInitException
-
- All Implemented Interfaces:
java.io.Serializable
public class ProcessInitException extends java.io.IOException
Creating a process failed providing an error code.Wraps an
IOException
like:java.io.IOException: Cannot run program "ls": java.io.IOException: error=12, Cannot allocate memory
java.io.IOException: Cannot run program "ls": error=316, Unknown error: 316
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String
AFTER_CODE
private static java.lang.String
BEFORE_CODE
private int
errorCode
private static java.lang.String
NEW_INFIX
-
Constructor Summary
Constructors Constructor Description ProcessInitException(java.lang.String message, java.lang.Throwable cause, int errorCode)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description int
getErrorCode()
static ProcessInitException
newInstance(java.lang.String prefix, java.io.IOException e)
Try to wrap a givenIOException
into aProcessInitException
.
-
-
-
Field Detail
-
BEFORE_CODE
private static final java.lang.String BEFORE_CODE
- See Also:
- Constant Field Values
-
AFTER_CODE
private static final java.lang.String AFTER_CODE
- See Also:
- Constant Field Values
-
NEW_INFIX
private static final java.lang.String NEW_INFIX
- See Also:
- Constant Field Values
-
errorCode
private final int errorCode
-
-
Method Detail
-
getErrorCode
public int getErrorCode()
- Returns:
- error code raised when a process failed to start.
-
newInstance
public static ProcessInitException newInstance(java.lang.String prefix, java.io.IOException e)
Try to wrap a givenIOException
into aProcessInitException
.- Parameters:
prefix
- prefix to be added in the message.e
- existing exception possibly containing an error code in its message.- Returns:
- new exception containing the prefix, error code and its description in the message plus the error code value as a field,
null
if we were unable to find an error code from the original message.
-
-