Always reject Promises with Error instances

This commit is contained in:
Felix Becker
2017-06-19 19:35:58 +02:00
parent d0a6cc2715
commit dbe0f89264
63 changed files with 207 additions and 236 deletions

View File

@@ -23,12 +23,12 @@ suite('Cache', () => {
test('simple error', () => {
let counter = 0;
const cache = new Cache(() => TPromise.wrapError(counter++));
const cache = new Cache(() => TPromise.wrapError(new Error(String(counter++))));
return cache.get()
.then(() => assert.fail(), err => assert.equal(err, 0))
.then(() => assert.fail(), err => assert.equal(err.message, 0))
.then(() => cache.get())
.then(() => assert.fail(), err => assert.equal(err, 0));
.then(() => assert.fail(), err => assert.equal(err.message, 0));
});
test('should retry cancellations', () => {