synchronous-promise
Advanced tools
Comparing version 2.0.4 to 2.0.5
@@ -1,2 +0,2 @@ | ||
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ | ||
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ | ||
window.SynchronousPromise = require('./index').SynchronousPromise; | ||
@@ -159,4 +159,9 @@ },{"./index":2}],2:[function(require,module,exports){ | ||
if (cont.catchFn) { | ||
var catchResult = cont.catchFn(error); | ||
self._handleUserFunctionResult(catchResult, cont.promise); | ||
try { | ||
var catchResult = cont.catchFn(error); | ||
self._handleUserFunctionResult(catchResult, cont.promise); | ||
} catch (e) { | ||
var message = e.message; | ||
cont.promise.reject(e); | ||
} | ||
} else { | ||
@@ -324,3 +329,3 @@ cont.promise.reject(error); | ||
return __awaiter; | ||
} | ||
} | ||
var result = patchAwaiterIfRequired(__awaiter); | ||
@@ -327,0 +332,0 @@ Promise = SynchronousPromise; |
@@ -0,0 +0,0 @@ /// <reference path="index.d.ts" /> |
@@ -0,0 +0,0 @@ export interface SynchronousPromise<T> extends Promise<T> { |
11
index.js
@@ -156,4 +156,9 @@ /* jshint node: true */ | ||
if (cont.catchFn) { | ||
var catchResult = cont.catchFn(error); | ||
self._handleUserFunctionResult(catchResult, cont.promise); | ||
try { | ||
var catchResult = cont.catchFn(error); | ||
self._handleUserFunctionResult(catchResult, cont.promise); | ||
} catch (e) { | ||
var message = e.message; | ||
cont.promise.reject(e); | ||
} | ||
} else { | ||
@@ -321,3 +326,3 @@ cont.promise.reject(error); | ||
return __awaiter; | ||
} | ||
} | ||
var result = patchAwaiterIfRequired(__awaiter); | ||
@@ -324,0 +329,0 @@ Promise = SynchronousPromise; |
@@ -76,2 +76,22 @@ /* | ||
it(`should allow re-throwing in a .catch and re-catching later`, () => { | ||
// Arrange | ||
var | ||
sut = createResolved(), | ||
error1 = "moo", | ||
received = null, | ||
expected = "moo-cow"; | ||
// Act | ||
sut.then(function () { | ||
throw new Error(error1); | ||
}).catch(function (err) { | ||
debugger; | ||
throw new Error(err.message + "-cow"); | ||
}).catch(function (err) { | ||
received = err.message; | ||
}); | ||
// Assert | ||
expect(received).to.equal(expected); | ||
}); | ||
it("should call the catch from a rejection invoke", () => { | ||
@@ -78,0 +98,0 @@ // Arrange |
{ | ||
"name": "synchronous-promise", | ||
"version": "2.0.4", | ||
"version": "2.0.5", | ||
"description": "Synchronous Promise-like prototype to use in testing where you would have used an ES6 Promise", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -0,0 +0,0 @@ # synchronous-promise |
@@ -0,0 +0,0 @@ { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69885
11
1675