Commit 260676bb authored by analog-nico's avatar analog-nico
Browse files

Catching exceptions of the transform function

parent 51a5c735
Loading
Loading
Loading
Loading
+5 −1
Original line number Original line Diff line number Diff line
@@ -42,7 +42,11 @@ function buildPromise (c, requester) {
                });
                });
            } else {
            } else {
                if (c.transform && typeof c.transform === 'function') {
                if (c.transform && typeof c.transform === 'function') {
                    try {
                        resolve(c.transform(body, response));
                        resolve(c.transform(body, response));
                    } catch (e) {
                        reject(e);
                    }
                } else if (c.resolveWithFullResponse) {
                } else if (c.resolveWithFullResponse) {
                    resolve(response);
                    resolve(response);
                } else {
                } else {
+1 −2
Original line number Original line Diff line number Diff line
@@ -312,8 +312,7 @@ describe('Request-Promise', function () {


        });
        });


        // FIXME
        it('that throws an exception', function () {
        xit('that throws an exception', function () {


            var options = {
            var options = {
                url: 'http://localhost:4000/200',
                url: 'http://localhost:4000/200',