Skip to content

Commit 0b79762

Browse files
authored
Merge pull request #842 from abetomo/fix-create-function
Fix `_isFunctionDoesNotExist()`
2 parents 5cdbe01 + 6bc6749 commit 0b79762

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ they may not work as expected in the Lambda environment.
950950
}
951951

952952
_isFunctionDoesNotExist (err) {
953-
return err.code === 'ResourceNotFoundException' &&
953+
return err.name === 'ResourceNotFoundException' &&
954954
!!err.message.match(/^Function not found:/)
955955
}
956956

test/main.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -219,15 +219,15 @@ describe('lib/main', function () {
219219
describe('_isFunctionDoesNotExist', () => {
220220
it('=== true', () => {
221221
const err = {
222-
code: 'ResourceNotFoundException',
222+
name: 'ResourceNotFoundException',
223223
message: 'Function not found: arn:aws:lambda:XXX'
224224
}
225225
assert.isTrue(lambda._isFunctionDoesNotExist(err))
226226
})
227227

228228
it('=== false', () => {
229229
const err = {
230-
code: 'MissingRequiredParameter',
230+
name: 'MissingRequiredParameter',
231231
message: 'Missing required key \'FunctionName\' in params'
232232
}
233233
assert.isFalse(lambda._isFunctionDoesNotExist(err))

0 commit comments

Comments
 (0)