File tree Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Expand file tree Collapse file tree 1 file changed +8
-10
lines changed Original file line number Diff line number Diff line change 1
1
const EventEmitter = require ( 'events' ) . EventEmitter ;
2
2
const util = require ( 'util' ) ;
3
3
const AWS = require ( 'aws-sdk' ) ;
4
- var parser = require ( 'aws-arn-parser' ) ;
4
+ const parser = require ( 'aws-arn-parser' ) ;
5
5
6
6
const Pooler = require ( './pooler.js' ) ;
7
7
const replaceError = require ( './replace-error.js' ) ;
@@ -29,15 +29,7 @@ function Worker(options) {
29
29
this . autoStart = typeof ( options . autoStart ) === 'boolean' ? options . autoStart : true ;
30
30
31
31
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' ) ) ;
41
33
}
42
34
43
35
this . concurrency = typeof ( options . concurrency ) === 'number' ? options . concurrency : 1 ;
@@ -57,6 +49,12 @@ function Worker(options) {
57
49
throw ( new TypeError ( 'worker does not define any function' ) ) ;
58
50
}
59
51
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
+
60
58
if ( this . autoStart ) {
61
59
setImmediate ( ( ) => {
62
60
this . start ( ( ) => {
You can’t perform that action at this time.
0 commit comments