Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
fix(lambda.js): revert catch unhandled promise rejections
Browse files Browse the repository at this point in the history
This reverts commit d06db15.
  • Loading branch information
ranrib authored Jan 20, 2021
1 parent 4b5c05f commit fdd78e2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 23 deletions.
11 changes: 0 additions & 11 deletions src/wrappers/lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,6 @@ function baseLambdaWrapper(
process._events.beforeExit = originalBeforeExit;
});
};
// catch an unhandled promise rejection within the user's code
process.once('unhandledRejection', (reason) => {
utils.debugLog('Unhandled Promise Rejection caught. Please handle the rejected promise');
const rejectedError = {
name: 'UnhandledPromiseRejectionError',
message: reason || '',
stack: '',
};
eventInterface.setException(runner, rejectedError, false);
});


const handleUserExecutionDone = (error, result, sendSync) => {
clearTimeout(timeoutHandler);
Expand Down
12 changes: 0 additions & 12 deletions test/unit_tests/wrappers/test_lambda.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ describe('lambdaWrapper tests', () => {
done() {},
};
consts.COLD_START = true;
process.setMaxListeners(0);
});

afterEach(() => {
Expand Down Expand Up @@ -278,17 +277,6 @@ describe('lambdaWrapper tests', () => {
}, 1);
});

it('lambdaWrapper: catch unhandled rejected promise', (done) => {
this.stubFunction = sinon.spy(() => {
// eslint-disable-next-line prefer-promise-reject-errors,no-new
new Promise((_, reject) => reject('Unauthorized'));
return 'success';
});
this.wrappedStub = lambdaWrapper.lambdaWrapper(this.stubFunction);
expect(this.wrappedStub({}, null, this.callbackStub)).to.equal('success');
done();
});

it('lambdaWrapper: update COLD_START value', () => {
consts.COLD_START = true;
this.wrappedStub({}, this.context, this.callbackStub);
Expand Down

0 comments on commit fdd78e2

Please sign in to comment.