Skip to content

Commit 920f128

Browse files
ShadowCat567Vieltojarvi
andauthored
Mapping for data schema errors (#2536)
* added mapping for schema errors that come from Toolkit * changeset * update mapping --------- Co-authored-by: Vieltojarvi <[email protected]>
1 parent f6171a2 commit 920f128

File tree

3 files changed

+22
-0
lines changed

3 files changed

+22
-0
lines changed

.changeset/rich-sheep-double.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@aws-amplify/backend-deployer': patch
3+
---
4+
5+
updated mapping with schema errors from toolkit

packages/backend-deployer/src/cdk_error_mapper.test.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,13 @@ const testErrorMappings = [
426426
errorName: 'GetLambdaLayerVersionError',
427427
expectedDownstreamErrorMessage: undefined,
428428
},
429+
{
430+
errorMessage: `amplify-some-stack [22m failed: _ToolkitError: Found 2 problem(s) with the schema: The input value type 'string' is not present when resolving type 'TaskInput' [@78:1] The field type 'TaskInstanceStatus' is not present when resolving type 'Task' [@25:1]`,
431+
expectedTopLevelErrorMessage:
432+
'2 problem(s) have been found with your schema',
433+
errorName: 'SchemaError',
434+
expectedDownstreamErrorMessage: undefined,
435+
},
429436
{
430437
// eslint-disable-next-line spellcheck/spell-checker
431438
errorMessage: `Error: npm error code EJSONPARSE

packages/backend-deployer/src/cdk_error_mapper.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,15 @@ export class CdkErrorMapper {
303303
errorName: 'AccessDeniedError',
304304
classification: 'ERROR',
305305
},
306+
{
307+
errorRegex: /Found (?<number>.*) problem\(s\) with the schema:/,
308+
humanReadableErrorMessage:
309+
'{number} problem(s) have been found with your schema',
310+
resolutionMessage:
311+
'See the underlying error message for details about what the problems are and resolve them before attempting this action again',
312+
errorName: 'SchemaError',
313+
classification: 'ERROR',
314+
},
306315
{
307316
// Also extracts the first line in the stack where the error happened
308317
errorRegex: new RegExp(
@@ -593,6 +602,7 @@ export type CDKDeploymentError =
593602
| 'InsufficientMemorySpaceError'
594603
| 'InvalidOrCannotAssumeRoleError'
595604
| 'InvalidPackageJsonError'
605+
| 'SchemaError'
596606
| 'SecretNotSetError'
597607
| 'SyntaxError'
598608
| 'GetLambdaLayerVersionError'

0 commit comments

Comments
 (0)