The goog.debug.ErrorHandler Class

goog.debug.ErrorHandler
> goog.Disposable

goog.debug.ErrorHandler(handler)

The ErrorHandler can be used to to wrap functions with a try/catch statement. If an exception is thrown, the given error handler function will be called. When this object is disposed, it will stop handling exceptions and tracing. It will also try to restore window.setTimeout and window.setInterval if it wrapped them. Notice that in the general case, it is not technically possible to remove the wrapper, because functions have no knowledge of what they have been assigned to. So the app is responsible for other forms of unwrapping.

handler {Function}
Handler for exceptions.

The goog.debug.ErrorHandler.ProtectedFunctionError Class

Error thrown to the caller of a protected entry point if the entry point throws an error. … more

.addOnDisposeCallback(callback, opt_scope)

Inherited from goog.Disposable .

Invokes a callback function when this object is disposed. Callbacks are invoked in the order in which they were added.

callback {!Function}
The callback function.
opt_scope {Object=}
An optional scope to call the callback in.

.creationStack {string}

Inherited from goog.Disposable .

If monitoring the goog.Disposable instances is enabled, stores the creation stack trace of the Disposable instance.

.dispose()

Inherited from goog.Disposable .

Disposes of the object. If the object hasn't already been disposed of, calls {@link #disposeInternal}. Classes that extend {@code goog.Disposable} should override {@link #disposeInternal} in order to delete references to COM objects, DOM nodes, and other disposable objects. Reentrant.

returns {void}
Nothing.

.isDisposed()

Inherited from goog.Disposable .

returns {boolean}
Whether the object has been disposed of.

.protectEntryPoint(fn)

Installs exception protection for an entry point function. When an exception is thrown from a protected function, a handler will be invoked to handle it.

fn {Function}
An entry point function to be protected.
returns {!Function}
A protected wrapper function that calls the entry point function.

.protectWindowSetInterval()

Install exception protection for window.setInterval to handle exceptions.

.protectWindowSetTimeout()

Installs exception protection for window.setTimeout to handle exceptions.

.registerDisposable(disposable)

Inherited from goog.Disposable .

Associates a disposable object with this object so that they will be disposed together.

disposable {goog.disposable.IDisposable}
that will be disposed when this object is disposed.

.setAddTracersToProtectedFunctions(newVal)

Enable tracers when instrumenting entry points.

newVal {boolean}
See above.

.unwrap()

.wrap()