Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/third_party/closure/goog/async/throwexception.js
4523 views
1
/**
2
* @license
3
* Copyright The Closure Library Authors.
4
* SPDX-License-Identifier: Apache-2.0
5
*/
6
7
/**
8
* @fileoverview Provides a function to throw an error without interrupting
9
* the current execution context.
10
*/
11
12
goog.module('goog.async.throwException');
13
goog.module.declareLegacyNamespace();
14
15
/**
16
* Throw an item without interrupting the current execution context. For
17
* example, if processing a group of items in a loop, sometimes it is useful
18
* to report an error while still allowing the rest of the batch to be
19
* processed.
20
* @param {*} exception
21
*/
22
function throwException(exception) {
23
// Each throw needs to be in its own context.
24
goog.global.setTimeout(() => {
25
throw exception;
26
}, 0);
27
}
28
exports = throwException;
29
30