Skip to content

Commit dadbaa4

Browse files
chore: update error handling
1 parent c800f3e commit dadbaa4

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

packages/amplify-gen2-migration-e2e-system/src/core/category-initializer.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,17 +201,22 @@ export class CategoryInitializer {
201201
IAM: 'IAM',
202202
API_KEY: 'API key',
203203
COGNITO_USER_POOLS: 'Amazon Cognito User Pool',
204+
AMAZON_COGNITO_USER_POOLS: 'Amazon Cognito User Pool',
204205
};
205206

206207
const authTypesConfig: Record<string, Record<string, unknown>> = {};
207208
for (const mode of apiConfig.authModes ?? []) {
208209
const mapped = authModeMap[mode];
209-
if (mapped) authTypesConfig[mapped] = {};
210+
if (!mapped) {
211+
throw new Error(
212+
`Unsupported auth mode '${mode}' in migration-config.json. Supported modes: ${Object.keys(authModeMap).join(', ')}`,
213+
);
214+
}
215+
authTypesConfig[mapped] = {};
210216
}
211217

212-
// Fallback: ensure at least API key is present
213218
if (Object.keys(authTypesConfig).length === 0) {
214-
authTypesConfig['API key'] = {};
219+
throw new Error('migration-config.json must specify at least one authMode for the GraphQL API');
215220
}
216221

217222
// Pass requireAuthSetup = false because the auth category is already initialized

0 commit comments

Comments
 (0)