Skip to content

Commit 6ac4503

Browse files
committed
fix: travis
1 parent f7667fd commit 6ac4503

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

lib/worker.js

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const EventEmitter = require('events').EventEmitter;
22
const util = require('util');
33
const AWS = require('aws-sdk');
4-
var parser = require('aws-arn-parser');
4+
const parser = require('aws-arn-parser');
55

66
const Pooler = require('./pooler.js');
77
const replaceError = require('./replace-error.js');
@@ -29,15 +29,7 @@ function Worker(options) {
2929
this.autoStart = typeof (options.autoStart) === 'boolean' ? options.autoStart : true;
3030

3131
if (!options.activityArn) {
32-
throw(new Error('activityArn is mandatory inside Worker'));
33-
return;
34-
}
35-
36-
const {region} = parser(options.activityArn);
37-
38-
if(this.stepfunction.config.region !== region){
39-
throw(new Error(`activity ARN region (${region}) should match with AWS Region (${this.stepfunction.config.region})`));
40-
return;
32+
throw (new Error('activityArn is mandatory inside Worker'));
4133
}
4234

4335
this.concurrency = typeof (options.concurrency) === 'number' ? options.concurrency : 1;
@@ -57,6 +49,12 @@ function Worker(options) {
5749
throw (new TypeError('worker does not define any function'));
5850
}
5951

52+
const {region} = parser(options.activityArn);
53+
54+
if (typeof (region) === 'string' && (this.stepfunction.config.region !== region)) {
55+
throw (new Error(`activity ARN region (${region}) should match with AWS Region (${this.stepfunction.config.region})`));
56+
}
57+
6058
if (this.autoStart) {
6159
setImmediate(() => {
6260
this.start(() => {

0 commit comments

Comments
 (0)