debug.js
No description.

File Location

/goog/debug/debug.js


Public Protected Private

Global Functions

goog.debug.catchErrors(logFuncopt_cancelopt_target)
Catches onerror events fired by windows and similar objects.
Arguments:
logFunc : function(Object)
The function to call with the error information.
opt_cancel : boolean=
Whether to stop the error from reaching the browser.
opt_target : Object=
Object that fires onerror events.
code »
goog.debug.deepExpose(objopt_showFn) string
Creates a string representing a given primitive or object, and for an object, all its properties and nested objects. WARNING: If an object is given, it and all its nested objects will be modified. To detect reference cycles, this method identifies objects using goog.getUid() which mutates the object.
Arguments:
obj : *
Object to expose.
opt_showFn : boolean=
Also show properties that are functions (by default, functions are omitted).
Returns: string  A string representation of obj.
code »
goog.debug.enhanceError(erropt_message) !Error
Converts an object to an Error if it's a String, adds a stacktrace if there isn't one, and optionally adds an extra message.
Arguments:
err : Error | string
the original thrown object or string.
opt_message : string=
optional additional message to add to the error.
Returns: !Error  If err is a string, it is used to create a new Error, which is enhanced and returned. Otherwise err itself is enhanced and returned.
code »
goog.debug.expose(objopt_showFn) string
Creates a string representing an object and all its properties.
Arguments:
obj : Object | null | undefined
Object to expose.
opt_showFn : boolean=
Show the functions as well as the properties, default is false.
Returns: string  The string representation of obj.
code »
goog.debug.exposeArray(arr) string
Recursively outputs a nested array as a string.
Arguments:
arr : Array
The array.
Returns: string  String representing nested array.
code »
goog.debug.exposeException(erropt_fn) string
Exposes an exception that has been caught by a try...catch and outputs the error with a stack trace.
Arguments:
err : Object
Error object or string.
opt_fn : Function=
Optional function to start stack trace from.
Returns: string  Details of exception.
code »
goog.debug.fnNameResolver_()
Resolves functions to their names. Resolved function names will be cached.
code »
goog.debug.getFunctionName(fn) string
Gets a function name
Arguments:
fn : Function
Function to get name of.
Returns: string  Function's name.
code »
goog.debug.getNativeStackTrace_(fn) ?string
No description.
Arguments:
fn : Function
The function to start getting the trace from.
Returns: ?string  No description.
code »
goog.debug.getStacktrace(opt_fn) string
Gets the current stack trace, either starting from the caller or starting from a specified function that's currently on the call stack.
Arguments:
opt_fn : Function=
Optional function to start getting the trace from. If not provided, defaults to the function that called this.
Returns: string  Stack trace.
code »
goog.debug.getStacktraceHelper_(fnvisited) string
Private helper for getStacktrace().
Arguments:
fn : Function
Function to start getting the trace from.
visited : Array
List of functions visited so far.
Returns: string  Stack trace starting from function fn.
code »
goog.debug.getStacktraceSimple(opt_depth) string
Gets the current stack trace. Simple and iterative - doesn't worry about catching circular references or getting the args.
Arguments:
opt_depth : number=
Optional maximum depth to trace back to.
Returns: string  A string with the function names of all functions in the stack, separated by \n.
code »
goog.debug.deepExpose&helper()
No description.
code »
goog.debug.deepExpose&helper&indentMultiline()
No description.
code »
goog.debug.makeWhitespaceVisible(string) string
Makes whitespace visible by replacing it with printable characters. This is useful in finding diffrences between the expected and the actual output strings of a testcase.
Arguments:
string : string
whose whitespace needs to be made visible.
Returns: string  string whose whitespace is made visible.
code »
goog.debug.normalizeErrorObject(err) !Object
Normalizes the error/exception object between browsers.
Arguments:
err : Object
Raw error object.
Returns: !Object  Normalized error object.
code »
goog.debug.catchErrors&oldErrorHandler()
No description.
code »
goog.debug.catchErrors&target.onerror(messageurllineopt_colopt_error) boolean
New onerror handler for this target. This onerror handler follows the spec according to http://www.whatwg.org/specs/web-apps/current-work/#runtime-script-errors The spec was changed in August 2013 to support receiving column information and an error object for all scripts on the same origin or cross origin scripts with the proper headers. See https://mikewest.org/2013/08/debugging-runtime-errors-with-window-onerror
Arguments:
message : string
The error message. For cross-origin errors, this will be scrubbed to just "Script error.". For new browsers that have updated to follow the latest spec, errors that come from origins that have proper cross origin headers will not be scrubbed.
url : string
The URL of the script that caused the error. The URL will be scrubbed to "" for cross origin scripts unless the script has proper cross origin headers and the browser has updated to the latest spec.
line : number
The line number in the script that the error occurred on.
opt_col : number=
The optional column number that the error occurred on. Only browsers that have updated to the latest spec will include this.
opt_error : Error=
The optional actual error object for this error that should include the stack. Only browsers that have updated to the latest spec will inlude this parameter.
Returns: boolean  Whether to prevent the error from reaching the browser.
code »
goog.debug.setFunctionResolver(resolver)
Set a custom function name resolver.
Arguments:
resolver : function(Function): string
Resolves functions to their names.
code »

Directory debug

File Reference