Skip to content

Commit f5cbb56

Browse files
committed
fix(import): show friendly error for non-existent evaluator ID
getEvaluator() now catches ResourceNotFoundException and ValidationException from the SDK and rethrows a clear message instead of exposing the raw regex validation error.
1 parent 1506e14 commit f5cbb56

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

src/cli/aws/agentcore-control.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,16 @@ export async function getEvaluator(options: GetEvaluatorOptions): Promise<GetEva
472472
evaluatorId: options.evaluatorId,
473473
});
474474

475-
const response = await client.send(command);
475+
let response;
476+
try {
477+
response = await client.send(command);
478+
} catch (err: unknown) {
479+
const name = (err as { name?: string }).name ?? '';
480+
if (name === 'ResourceNotFoundException' || name === 'ValidationException') {
481+
throw new Error(`Evaluator "${options.evaluatorId}" not found. Verify the evaluator ID or ARN is correct.`);
482+
}
483+
throw err;
484+
}
476485

477486
if (!response.evaluatorId) {
478487
throw new Error(`No evaluator found for ID ${options.evaluatorId}`);

0 commit comments

Comments
 (0)