Skip to content

Commit

Permalink
fix: improve trigger update error handling, ref #8280 (#8329)
Browse files Browse the repository at this point in the history
  • Loading branch information
josefaidt committed Oct 21, 2021
1 parent 239f1ac commit 40f9cb0
Showing 1 changed file with 6 additions and 4 deletions.
Expand Up @@ -3,7 +3,7 @@ import chalk from 'chalk';
import * as fs from 'fs-extra';
import * as path from 'path';
import _ from 'lodash';
import { JSONUtilities, $TSAny } from 'amplify-cli-core';
import { exitOnNextTick, JSONUtilities, $TSAny } from 'amplify-cli-core';
import Separator from 'inquirer/lib/objects/separator';

// keep in sync with ServiceName in amplify-category-function, but probably it will not change
Expand Down Expand Up @@ -193,10 +193,12 @@ export const updateTrigger = async triggerOptions => {

await cleanFunctions(key, values, category, context, targetPath);
}
context.print.success('Successfully updated the Lambda function locally');
context.print.success('Successfully updated the Cognito trigger locally');
return null;
} catch (e) {
throw new Error('Unable to update lambda function');
} catch (err: $TSAny) {
context.print.error(`Error updating the Cognito trigger: ${err.message}`);
await context.usageData.emitError(err);
exitOnNextTick(1);
}
};

Expand Down

0 comments on commit 40f9cb0

Please sign in to comment.