npm package diff
Package: @forge/jira-bridge
Versions: 0.34.1-next.0 - 0.34.1-next.1
File: package/out/ui-modifications/onError.js
Index: package/out/ui-modifications/onError.js
===================================================================
--- package/out/ui-modifications/onError.js
+++ package/out/ui-modifications/onError.js
@@ -1,38 +1,35 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.onError = void 0;
-const tslib_1 = require("tslib");
const getInternalAPI_1 = require("./getInternalAPI");
const errors_1 = require("../errors");
-function onError(errorCallback) {
- return tslib_1.__awaiter(this, void 0, void 0, function* () {
- const { actions: { subscribeToErrors, onBridgeError } } = yield (0, getInternalAPI_1.getInternalAPI)();
- try {
- if (!subscribeToErrors)
- return;
- if (!errorCallback) {
- throw new errors_1.AppExecutionError('errorCallback is required');
- }
- if (typeof errorCallback !== 'function') {
- throw new errors_1.AppExecutionError('errorCallback should be a function');
- }
- return subscribeToErrors(({ errors }) => {
- if (errors === null || errors === void 0 ? void 0 : errors.length) {
- try {
- errorCallback({ errors });
- }
- catch (error) {
- throw new errors_1.AppExecutionError(error);
- }
- }
- });
+async function onError(errorCallback) {
+ const { actions: { subscribeToErrors, onBridgeError } } = await (0, getInternalAPI_1.getInternalAPI)();
+ try {
+ if (!subscribeToErrors)
+ return;
+ if (!errorCallback) {
+ throw new errors_1.AppExecutionError('errorCallback is required');
}
- catch (error) {
- if (onBridgeError && !(error instanceof errors_1.AppExecutionError)) {
- onBridgeError({ error: errors_1.ON_ERROR_ERROR });
+ if (typeof errorCallback !== 'function') {
+ throw new errors_1.AppExecutionError('errorCallback should be a function');
+ }
+ return subscribeToErrors(({ errors }) => {
+ if (errors === null || errors === void 0 ? void 0 : errors.length) {
+ try {
+ errorCallback({ errors });
+ }
+ catch (error) {
+ throw new errors_1.AppExecutionError(error);
+ }
}
- throw error;
+ });
+ }
+ catch (error) {
+ if (onBridgeError && !(error instanceof errors_1.AppExecutionError)) {
+ onBridgeError({ error: errors_1.ON_ERROR_ERROR });
}
- });
+ throw error;
+ }
}
exports.onError = onError;