public class ComputationExceptionBuilder extends Object
ComputationException
.
The builder provides methods to register logs and files from different sources.Constructor and Description |
---|
ComputationExceptionBuilder()
Initializes the builder, with no cause, no message and no logs.
|
ComputationExceptionBuilder(Throwable cause)
Initializes the builder with the specified exception as the computation exception cause.
|
Modifier and Type | Method and Description |
---|---|
ComputationExceptionBuilder |
addBytes(String key,
byte[] bytes)
Adds raw content of a file to collected data.
|
ComputationExceptionBuilder |
addErrLog(String logName,
String log)
Adds an error log to collected data.
|
ComputationExceptionBuilder |
addErrLogIfExists(Path path)
Reads the content of standard error file at specified path, assuming UTF-8 encoding.
|
ComputationExceptionBuilder |
addFileIfExists(Path path)
Adds the content of a the file at specified path to collected data.
|
ComputationExceptionBuilder |
addOutLog(String logName,
String log)
Adds a standard output log to collected data.
|
ComputationExceptionBuilder |
addOutLogIfExists(Path path)
Reads the content of standard output file at specified path, assuming UTF-8 encoding.
|
ComputationException |
build()
Creates the computation exception.
|
ComputationExceptionBuilder |
message(String message)
Defines the detail message of the created computation exception.
|
public ComputationExceptionBuilder()
public ComputationExceptionBuilder(Throwable cause)
public ComputationExceptionBuilder message(@Nullable String message)
message
- the detail message of the computation exception.public ComputationExceptionBuilder addOutLogIfExists(@Nullable Path path)
null
or file does not exist, this is a no-op.path
- The path to the standard output file.public ComputationExceptionBuilder addOutLog(String logName, @Nullable String log)
logName
- the log name, must not be null
log
- log content, may be null
public ComputationExceptionBuilder addErrLogIfExists(@Nullable Path path)
null
or file does not exist, this is a no-op.path
- The path to the standard error file.public ComputationExceptionBuilder addErrLog(String logName, @Nullable String log)
logName
- the log name, must not be null
log
- log content, may be null
public ComputationExceptionBuilder addFileIfExists(@Nullable Path path)
null
or file does not exist, this is a no-op.path
- to the file to be added to collected data.public ComputationExceptionBuilder addBytes(String key, byte[] bytes)
key
- The log file name.bytes
- Bytes.public ComputationException build()
Copyright © 2020. All rights reserved.