Path: blob/trunk/third_party/closure/goog/async/throwexception.js
4523 views
/**1* @license2* Copyright The Closure Library Authors.3* SPDX-License-Identifier: Apache-2.04*/56/**7* @fileoverview Provides a function to throw an error without interrupting8* the current execution context.9*/1011goog.module('goog.async.throwException');12goog.module.declareLegacyNamespace();1314/**15* Throw an item without interrupting the current execution context. For16* example, if processing a group of items in a loop, sometimes it is useful17* to report an error while still allowing the rest of the batch to be18* processed.19* @param {*} exception20*/21function throwException(exception) {22// Each throw needs to be in its own context.23goog.global.setTimeout(() => {24throw exception;25}, 0);26}27exports = throwException;282930