Skip to content

Commit 86e9d03

Browse files
spgrix0rrr
authored andcommitted
fix(stepfunctions): make Fail.error optional (#2042)
Error codes are optional in ASL.
1 parent b93350f commit 86e9d03

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ export interface FailProps {
1515

1616
/**
1717
* Error code used to represent this failure
18+
*
19+
* @default No error code
1820
*/
19-
error: string;
21+
error?: string;
2022

2123
/**
2224
* A description for the cause of the failure
@@ -34,10 +36,10 @@ export interface FailProps {
3436
export class Fail extends State {
3537
public readonly endStates: INextable[] = [];
3638

37-
private readonly error: string;
39+
private readonly error?: string;
3840
private readonly cause?: string;
3941

40-
constructor(scope: cdk.Construct, id: string, props: FailProps) {
42+
constructor(scope: cdk.Construct, id: string, props: FailProps = {}) {
4143
super(scope, id, props);
4244

4345
this.error = props.error;
@@ -55,4 +57,4 @@ export class Fail extends State {
5557
Cause: this.cause,
5658
};
5759
}
58-
}
60+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import cdk = require('@aws-cdk/cdk');
2+
import { Test } from 'nodeunit';
3+
import stepfunctions = require('../lib');
4+
5+
export = {
6+
'Props are optional'(test: Test) {
7+
const stack = new cdk.Stack();
8+
9+
new stepfunctions.Fail(stack, 'Fail');
10+
11+
test.done();
12+
}
13+
};

0 commit comments

Comments
 (0)