diff --git a/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts b/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts index f033e32d7cd43..0fad0bf89cd8c 100644 --- a/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts +++ b/packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts @@ -15,8 +15,10 @@ export interface FailProps { /** * Error code used to represent this failure + * + * @default No error code */ - error: string; + error?: string; /** * A description for the cause of the failure @@ -34,10 +36,10 @@ export interface FailProps { export class Fail extends State { public readonly endStates: INextable[] = []; - private readonly error: string; + private readonly error?: string; private readonly cause?: string; - constructor(scope: cdk.Construct, id: string, props: FailProps) { + constructor(scope: cdk.Construct, id: string, props: FailProps = {}) { super(scope, id, props); this.error = props.error; @@ -55,4 +57,4 @@ export class Fail extends State { Cause: this.cause, }; } -} \ No newline at end of file +} diff --git a/packages/@aws-cdk/aws-stepfunctions/test/test.fail.ts b/packages/@aws-cdk/aws-stepfunctions/test/test.fail.ts new file mode 100644 index 0000000000000..4dfb061328392 --- /dev/null +++ b/packages/@aws-cdk/aws-stepfunctions/test/test.fail.ts @@ -0,0 +1,13 @@ +import cdk = require('@aws-cdk/cdk'); +import { Test } from 'nodeunit'; +import stepfunctions = require('../lib'); + +export = { + 'Props are optional'(test: Test) { + const stack = new cdk.Stack(); + + new stepfunctions.Fail(stack, 'Fail'); + + test.done(); + } +};