Namespace: DuDebug

DuDebug

Tools for debugging

Members

staticDuDebug.debugLogDuDebugLog null

Set this attribute to a DuDebugLog you have created to automatically add some debug infos to the log (like catched errors).

static,readonlyDuDebug.LogLevelint

The log levels
Properties:
Name Type Default Description
VERBOSE int 0
DEBUG int 1
WARNING int 2
CRITICAL int 3
FATAL int 4
NO_DEBUG int 5

Methods

staticDuDebug.checkVar(variable, argName, argType, functionName){string|bool}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 770
Checks if the given variable has the correct type,
alerts a nice error if not using DuDebug.throwUndefinedError() or DuDebug.throwTypeError().
Name Type Description
variable any The variable to check
argName string The variable name
argType string optional The expected type name (as return by jstype()). If not provided, checks only if the var is undefined
functionName any optional The name or description of the function throwing the error.
Returns:
Type Description
string | bool The (multiline) description for the error if any and DuESF.debug is true, false if there's an error and DuESF.debug is false, true if everything is ok.

staticDuDebug.error(error)

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 566
This methods shows an alert with an error thrown if DuESF.debug is set to true, and logs it in DuESF.debug.DuDebugLog if it has been set.
The error is actually thrown only if JS Debugging is enabled in the host application, otherwise it is just shown in an alert.
Name Type Description
error Error | string An error thrown and catched

staticDuDebug.inspect(obj, ownProperties){string}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 630
Inspects a javascript object and outputs all of its attributes
Name Type Default Description
obj object The object to inspect.
ownProperties boolean true optional Whether to inspect only the own properties of the object.
Returns:
Type Description
string The report.

staticDuDebug.log(message, level)

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 556
Logs a message to DuDebug.DuDebugLog if it has been set.
Name Type Default Description
message string The message to log
level DuDebug.LogLevel DuDebug.LogLevel.DEBUG optional The level of the message

staticDuDebug.safeRun(callback){any}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 587
Runs a method/script safely, i.e. enclosed in a try...catch, and logs any error thrown.
arguments can be added after the first parameter, they will be passed to the callback.
The callback is enclosed in a function to make sure it does not create global variables.
Name Type Description
callback function | string The method to run, or a script as a string
Returns:
Type Description
any The return of the callback, null if it fails.

staticDuDebug.throwError(message, functionName, error, neverThrow){string}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 723
Alerts a nice Error description, if DuESF.debug is true, and logs it if there's a log..
Note that it does not actually throws an error.
Name Type Default Description
message any The message to show
functionName any optional The name or description of the function throwing the error.
error Error optional A JS error.
neverThrow Boolean false optional If true, will prevent actually throwing the error even if the debugger is enabled.
Returns:
Type Description
string The (multiline) description for the error

staticDuDebug.throwTypeError(variable, varName, varType, functionName){string}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 652
Alerts a nice TypeError description, if DuESF.debug is true, and logs it if there's a log.
Note that it does not actually throws an error.
Name Type Description
variable any The failing argument
varName string The failing argument name
varType string The expected type
functionName string optional The name or description of the function throwing the error.
Returns:
Type Description
string The (multiline) description for the error

staticDuDebug.throwUndefinedError(varName, functionName){string}

D:/RxLab/src/RxOT/DuAEF/Duik/Duik_API/DuAEF_Duik_api.jsxinc, line 688
Alerts a nice UndefinedError description, if DuESF.debug is true, and logs it if there's a log..
Note that it does not actually throws an error.
Name Type Description
varName any The name of the arg which should not be undefined
functionName any optional The name or description of the function throwing the error.
Returns:
Type Description
string The (multiline) description for the error