public static class ErrorManager.ErrorHelper
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private ErrorManager.ServerDataAccess |
srv
Server-side error methods.
|
private ErrorManager.WorkArea |
wa
Context-local error state.
|
Constructor and Description |
---|
ErrorHelper(ErrorManager.WorkArea wa,
ErrorManager.ServerDataAccess srv)
Create a new instance and associate the given WorkArea instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addError(int num,
java.lang.String text,
boolean errFlag,
boolean prefix)
Adds an error entry to the error list.
|
void |
addNumbersToConditionException(ConditionException e)
Adds error numbers to raised error numbers stack
|
void |
clearPending()
Clears pending error status.
|
void |
ignore(java.lang.Runnable code)
Execute the given block while supressing normal error processing by temporarily enabling the
ignore flag.
|
boolean |
isHeadless()
Determines if headless mode should be supported.
|
boolean |
isInCanFindBracket()
Detects if the temporary CAN-FIND headless mode is active.
|
boolean |
isPending()
Queries the state of
pendingError variable. |
boolean |
isSilent()
Reports on the context-local
silent flag. |
boolean |
isSuppressWarnings()
Reflects the value of SESSION:SUPPRESS-WARNINGS attribute.
|
boolean |
isWarningMode()
Reports if warning mode has been enabled.
|
void |
noRecordOrThrowError(java.lang.String msg)
|
void |
setCanFindBracket(boolean enter)
Sets silent mode during CAN-FIND calls.
|
void |
setHeadless(boolean headless)
Set the headless flag for this context.
|
void |
setPending(boolean value)
Sets the
pendingError variable. |
void |
setSilent(boolean value)
Sets the
silent variable. |
void |
setWarningMode(boolean on)
Configures warning mode, during which errors are non-fatal (when
on is true ), but are
reported to the UI of the current context via a call to LogicalTerminal.message() . |
boolean |
silent(java.lang.Runnable code)
Worker method that executes a given block of code with silent error mode turned on for
the duration of the code block.
|
private ErrorManager.WorkArea wa
private ErrorManager.ServerDataAccess srv
public ErrorHelper(ErrorManager.WorkArea wa, ErrorManager.ServerDataAccess srv)
wa
- Context-local error state.srv
- Server-side error methods.public boolean isSuppressWarnings()
public boolean isSilent()
silent
flag.true
if silent error mode is active.public void setSilent(boolean value)
silent
variable.value
- The new state of the variable.public boolean silent(java.lang.Runnable code)
This method can only be executed on the server side.
code
- The block of code to execute in silent mode.public boolean isPending()
pendingError
variable.true
if pending error flag is turned on, otherwise
false
.public void setPending(boolean value)
pendingError
variable.value
- The new state of the variable.public void clearPending()
public boolean isHeadless()
true
if the headless flag is turned on, otherwise false
.public void setHeadless(boolean headless)
headless
- true
if this context has no UI.public boolean isInCanFindBracket()
true
if this is a CAN-FIND bracket.public void setCanFindBracket(boolean enter)
ErrorManager
will run similar to headless mode
and will silently discard error messages.
NoteAlways call this method in pairs (one with enter = true before executing the query and, one with enter = false, immediately after) to assure the correct management of the headless context flag.
enter
- If true
will increment the nested CAN-FIND count.public void ignore(java.lang.Runnable code)
code
- The code to execute.public void addNumbersToConditionException(ConditionException e)
e
- The condition exception meant to be iterated for causespublic void addError(int num, java.lang.String text, boolean errFlag, boolean prefix)
num
- The error number.text
- The text of the error message.errFlag
- If false
this should add the number and text to
the error list but not set the error flag. If
true
the error flag should also be set.prefix
- true
to prepend a double asterisk prefix to the
formatted error message, false
to omit this text.public void noRecordOrThrowError(java.lang.String msg)
ErrorConditionException
and if in silent mode, it sets the
pending
flag to true
. NO error information (messages or
error numbers) will be recorded in either case (i.e. silent mode or not). In silent
mode the ERROR-STATUS:ERROR
will be true
but the other "records"
of the error that normally exist, will not exist. No message will be displayed. Because
no message is ever displayed or recorded, the normal error number/message processing
is not executed.
This only works on the server side.
msg
- The text to use in throwing the error exception.public boolean isWarningMode()
true
if warning mode is enabled, otherwise false
.public void setWarningMode(boolean on)
on
is true
), but are
reported to the UI of the current context via a call to LogicalTerminal.message()
.
Each call to this method must be matched with a corresponding call to ErrorManager.warningModeDisable()
.
on
- Pass true
to enable reported but non-fatal errors, and false
to handle
errors normally.