public abstract class ErrorableProcess extends Object implements Loggable
Modifier and Type | Field and Description |
---|---|
List<String> |
errors |
org.apache.logging.log4j.Logger |
log |
List<String> |
warnings |
Constructor and Description |
---|
ErrorableProcess(BroadWorksServer bws) |
Modifier and Type | Method and Description |
---|---|
void |
checkValidity()
Checks the validity of the process
|
String |
exception(Throwable throwable)
Adds an exception error to the errors to report.
|
List<String> |
getErrors()
Retrieves the Error list
|
String |
getReport() |
List<String> |
getWarnings()
Retrieves the Warning list
|
boolean |
hasErrors()
Reports if the process contains errors
|
boolean |
isError(Response response)
Checks if a response is an error -- If so add the response message to the list of errors
|
boolean |
isError(Response response,
boolean markErrorCodesAsWarnings,
String... expectedErrorCodes)
Checks if a Response is an error with optional expected error codes
|
boolean |
isError(Response response,
String... expectedErrorCodes)
Checks if a Response is an error with optional expected error codes
|
void |
printReport(PrintStream out)
Prints a report of errors and warnings to the provided printstream.
|
void |
setExceptionOnErrors(boolean exceptionOnErrors)
Determines whether to throw an exception on errors or just log.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSessionLogger, logger
public ErrorableProcess(BroadWorksServer bws)
public void setExceptionOnErrors(boolean exceptionOnErrors)
exceptionOnErrors
- a booleanpublic List<String> getWarnings()
public boolean hasErrors()
public void checkValidity() throws HelperException
HelperException
- Thrown if the process has errors.public void printReport(PrintStream out)
out
- The printstream to write the reportpublic String getReport()
public String exception(Throwable throwable)
throwable
- The throwable to process.public boolean isError(Response response)
response
- The response to checkpublic boolean isError(Response response, String... expectedErrorCodes)
response
- The response to checkexpectedErrorCodes
- The array of expected error codespublic boolean isError(Response response, boolean markErrorCodesAsWarnings, String... expectedErrorCodes)
response
- The response to checkmarkErrorCodesAsWarnings
- Flag to add expected error codes as warning messages.expectedErrorCodes
- The array of expected error codesCopyright © 2017 ECG. All rights reserved.