Skip to content

Commit 90603ca

Browse files
committed
Replace double quotes and backticks in error messages with single quotes
1 parent 2070a01 commit 90603ca

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

__tests__/intrinsicFunctions/ArgumentHandling.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ describe('Intrinsic function argument handling', () => {
105105

106106
expect(validateArgumentsWrapper).toThrow(StatesRuntimeError);
107107
expect(validateArgumentsWrapper).toThrow(
108-
/^Intrinsic function Generic.Function expected argument 1 to be of type "string", but received number$/
108+
/^Intrinsic function Generic.Function expected argument 1 to be of type 'string', but received number$/
109109
);
110110
});
111111

@@ -121,7 +121,7 @@ describe('Intrinsic function argument handling', () => {
121121

122122
expect(validateArgumentsWrapper).toThrow(StatesRuntimeError);
123123
expect(validateArgumentsWrapper).toThrow(
124-
/^Intrinsic function Generic.Function expected argument 1 to be of type "number", but received string$/
124+
/^Intrinsic function Generic.Function expected argument 1 to be of type 'number', but received string$/
125125
);
126126
});
127127

@@ -137,7 +137,7 @@ describe('Intrinsic function argument handling', () => {
137137

138138
expect(validateArgumentsWrapper).toThrow(StatesRuntimeError);
139139
expect(validateArgumentsWrapper).toThrow(
140-
/^Intrinsic function Generic.Function expected argument 1 to be of type "boolean", but received string$/
140+
/^Intrinsic function Generic.Function expected argument 1 to be of type 'boolean', but received string$/
141141
);
142142
});
143143

@@ -153,7 +153,7 @@ describe('Intrinsic function argument handling', () => {
153153

154154
expect(validateArgumentsWrapper).toThrow(StatesRuntimeError);
155155
expect(validateArgumentsWrapper).toThrow(
156-
/^Intrinsic function Generic.Function expected argument 1 to be of type "null", but received string$/
156+
/^Intrinsic function Generic.Function expected argument 1 to be of type 'null', but received string$/
157157
);
158158
});
159159

@@ -169,7 +169,7 @@ describe('Intrinsic function argument handling', () => {
169169

170170
expect(validateArgumentsWrapper).toThrow(StatesRuntimeError);
171171
expect(validateArgumentsWrapper).toThrow(
172-
/^Intrinsic function Generic.Function expected argument 1 to be of type "array", but received string$/
172+
/^Intrinsic function Generic.Function expected argument 1 to be of type 'array', but received string$/
173173
);
174174
});
175175

@@ -185,7 +185,7 @@ describe('Intrinsic function argument handling', () => {
185185

186186
expect(validateArgumentsWrapper).toThrow(StatesRuntimeError);
187187
expect(validateArgumentsWrapper).toThrow(
188-
/^Intrinsic function Generic.Function expected argument 1 to be of type "object", but received string$/
188+
/^Intrinsic function Generic.Function expected argument 1 to be of type 'object', but received string$/
189189
);
190190
});
191191

@@ -221,7 +221,7 @@ describe('Intrinsic function argument handling', () => {
221221

222222
expect(validateArgumentsWrapper).toThrow(StatesRuntimeError);
223223
expect(validateArgumentsWrapper).toThrow(
224-
/^Intrinsic function Generic.Function expected argument 1 to satisfy the following constraints: "ZERO"$/
224+
/^Intrinsic function Generic.Function expected argument 1 to satisfy the following constraints: 'ZERO'$/
225225
);
226226
});
227227

@@ -242,7 +242,7 @@ describe('Intrinsic function argument handling', () => {
242242

243243
expect(validateArgumentsWrapper).toThrow(StatesRuntimeError);
244244
expect(validateArgumentsWrapper).toThrow(
245-
/^Intrinsic function Generic.Function expected argument 1 to satisfy the following constraints: "POSITIVE_INTEGER"$/
245+
/^Intrinsic function Generic.Function expected argument 1 to satisfy the following constraints: 'POSITIVE_INTEGER'$/
246246
);
247247
});
248248

@@ -263,7 +263,7 @@ describe('Intrinsic function argument handling', () => {
263263

264264
expect(validateArgumentsWrapper).toThrow(StatesRuntimeError);
265265
expect(validateArgumentsWrapper).toThrow(
266-
/^Intrinsic function Generic.Function expected argument 1 to satisfy the following constraints: "NEGATIVE_INTEGER"$/
266+
/^Intrinsic function Generic.Function expected argument 1 to satisfy the following constraints: 'NEGATIVE_INTEGER'$/
267267
);
268268
});
269269

@@ -284,7 +284,7 @@ describe('Intrinsic function argument handling', () => {
284284

285285
expect(validateArgumentsWrapper).toThrow(StatesRuntimeError);
286286
expect(validateArgumentsWrapper).toThrow(
287-
/^Intrinsic function Generic.Function expected argument 1 to satisfy the following constraints: "INTEGER"$/
287+
/^Intrinsic function Generic.Function expected argument 1 to satisfy the following constraints: 'INTEGER'$/
288288
);
289289
});
290290
});

src/aws/LambdaClient.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ export class LambdaClient {
2323
if (config) {
2424
if (!config.region) {
2525
throw new StatesRuntimeError(
26-
'`awsConfig` option was specified for state machine, but `region` property is not set'
26+
"'awsConfig' option was specified for state machine, but 'region' property is not set"
2727
);
2828
}
2929

3030
// Check if multiple types of credentials were passed. Passing more than one type is an error.
3131
if (config.credentials) {
3232
const credentialsTypes = Object.keys(config.credentials);
33-
const credentialsNames = credentialsTypes.map((name) => `\`${name}\``).join(', ');
33+
const credentialsNames = credentialsTypes.map((name) => `'${name}'`).join(', ');
3434
if (credentialsTypes.length > 1) {
3535
throw new StatesRuntimeError(
3636
`More than one type of AWS credentials were specified: ${credentialsNames}. Only one type may be specified`
@@ -72,7 +72,7 @@ export class LambdaClient {
7272
const errorResult = resultValue as LambdaErrorResult;
7373
// Even though this is not a Fail State, we can take advantage of the `FailStateError`
7474
// to throw an error with a custom name and message.
75-
throw new FailStateError(errorResult.errorType, `Execution of Lambda function "${funcNameOrArn}" failed`);
75+
throw new FailStateError(errorResult.errorType, `Execution of Lambda function '${funcNameOrArn}' failed`);
7676
}
7777

7878
return resultValue;

src/stateMachine/intrinsicFunctions/ArgumentHandling.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function validateArgumentType(allowedTypes: ArgumentType[], argPosition: number,
3535
if (matchesAllowedType) break;
3636
}
3737

38-
const expectedType = allowedTypes.map((type) => `"${type}"`).join(' | ');
38+
const expectedType = allowedTypes.map((type) => `'${type}'`).join(' | ');
3939
if (!matchesAllowedType) {
4040
throw new StatesRuntimeError(
4141
`Intrinsic function ${funcName} expected argument ${argPosition} to be of type ${expectedType}, but received ${typeof funcArg}`
@@ -70,7 +70,7 @@ function validateArgumentConstraints(
7070
if (matchesAllConstraints) break;
7171
}
7272

73-
const expectedConstraints = argConstraints.map((constraint) => `"${constraint}"`).join(' | ');
73+
const expectedConstraints = argConstraints.map((constraint) => `'${constraint}'`).join(' | ');
7474
if (!matchesAllConstraints) {
7575
throw new StatesRuntimeError(
7676
`Intrinsic function ${funcName} expected argument ${argPosition} to satisfy the following constraints: ${expectedConstraints}`

0 commit comments

Comments
 (0)