ErrorsOverTime Class
Wraps up code that allows developers the ability to time box errors. In some instances errors will occur. It is only when a certain number of those errors occur within a given time span that it is recognized that recovery is improbable. When the threshold is broken the code allows you to throw an error that represents all others that contributed to the threshold breach.
Constructor
ErrorsOverTime
-
errorSpan
-
errorThreshold
-
[prefix]
Parameters:
-
errorSpan
IntegerThe upper bound on the number of errors that can occur within the provided time frame before it is determined that recovery is not possible.
-
errorThreshold
IntegerThe upper bound on the amount of time, in milliseconds, that errors can occur in before it is determined that recovery is not possible.
-
[prefix]
String optionalThe prefix to any error message that is generated by the instance
Item Index
Methods
Properties
Methods
createError
-
errors
-
prefix
Creates an Error that represents all of the errors that triggered the threshold breach.
Parameters:
-
errors
ArrayThe array of errors that will be represented by one wrapper error
-
prefix
StringThe error message text that will come first
Returns:
errorOccurred
-
The
Adds an error into the calculation to determine if too many errors have occurred within a particular time span.
Parameters:
-
The
Errorerror that occurred
Returns:
TRUE if threshold is in tact, FALSE if not
generateError
-
errors
-
prefix
Generates and throws an Error that represents all of the errors that triggered the threshold breach.
Parameters:
-
errors
ArrayThe array of errors that will be represented by one wrapper error
-
prefix
StringThe error message text that will come first
getRange
()
Integer
Gets the time span over which the current set of errors has occurred
Returns:
The number of milliseconds over which the last "n" number of errors have occurred where "n" is the value is between 0 and the value of the errorSpan property inclusive.
isWithinLimits
()
Boolean
Determines if the errors that have occurred are within the acceptable tolerance.
Returns:
TRUE if threshold in tact, FALSE if not
throwIfOutOfBounds
-
The
-
prefix
Adds an error into the calculation to determine if too many errors have occurred within a particular time span. If the threshold has been broken an error is thrown.
Parameters:
-
The
Errorerror that occurred
-
prefix
StringThe error message text that will come first
Returns:
TRUE if threshold is in tact, FALSE if not
Properties
errors
Array
The list of errors that will be used to determin if too many errors have occurred within a given time frame.
errorSpan
Integer
The upper bound on the number of errors that can occur within the provided time frame before it is determined that recovery is not possible.
errorThreshold
Integer
The upper bound on the amount of time, in milliseconds, that errors can occur in before it is determined that recovery is not possible.
prefix
String
The prefix to any error message that is generated by the instance
totalErrorCnt
Integer
The total number of errors that have occurred