goog.debug.ErrorHandler
Classgoog.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
}
goog.debug.ErrorHandler.ProtectedFunctionError
ClassError 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
}
opt_scope
{Object
=}
.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.
void
}
.disposeInternal()
[protected]Deletes or nulls out any references to COM objects, DOM nodes, or other disposable objects. Classes that extend {@code goog.Disposable} should override this method. Not reentrant. To avoid calling it twice, it must only be called from the subclass' {@code disposeInternal} method. Everywhere else the public {@code dispose} method must be used. For example:
mypackage.MyClass = function() { goog.base(this); // Constructor logic specific to MyClass. ... }; goog.inherits(mypackage.MyClass, goog.Disposable); mypackage.MyClass.prototype.disposeInternal = function() { goog.base(this, 'disposeInternal'); // Dispose logic specific to MyClass. ... };
.getDisposed
[deprecated]Deprecated. Use {@link #isDisposed} instead.
Inherited from goog.Disposable
.
boolean
}
.getProtectedFunction(fn)
[protected]Helps {@link #protectEntryPoint} by actually creating the protected wrapper function, after {@link #protectEntryPoint} determines that one does not already exist for the given function. Can be overriden by subclasses that may want to implement different error handling, or add additional entry point hooks.
fn
{!Function
}
Function
}
.isDisposed()
Inherited from goog.Disposable
.
boolean
}
.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
}
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
}
.setAddTracersToProtectedFunctions(newVal)
Enable tracers when instrumenting entry points.
newVal
{boolean
}
.unwrap()
.wrap()