Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(stepfunctions) make Fail.error optional #2042

Merged
merged 3 commits into from
Mar 21, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions packages/@aws-cdk/aws-stepfunctions/lib/states/fail.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
Expand All @@ -55,4 +57,4 @@ export class Fail extends State {
Cause: this.cause,
};
}
}
}
13 changes: 13 additions & 0 deletions packages/@aws-cdk/aws-stepfunctions/test/test.fail.ts
Original file line number Diff line number Diff line change
@@ -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();
}
};