mirror of
https://github.com/serverless/serverless.git
synced 2026-01-25 15:07:39 +00:00
refactor(AWS Deploy): Minimize try/catch wrap
This commit is contained in:
parent
6537a5e48d
commit
a7d2cf0605
@ -67,20 +67,21 @@ class AwsDeployFunction {
|
||||
FunctionName: this.options.functionObj.name,
|
||||
};
|
||||
|
||||
try {
|
||||
const result = await this.provider.request('Lambda', 'getFunction', params);
|
||||
const result = await (async () => {
|
||||
try {
|
||||
return await this.provider.request('Lambda', 'getFunction', params);
|
||||
} catch (error) {
|
||||
const errorMessage = [
|
||||
`The function "${this.options.function}" you want to update is not yet deployed.`,
|
||||
' Please run "serverless deploy" to deploy your service.',
|
||||
' After that you can redeploy your services functions with the',
|
||||
' "serverless deploy function" command.',
|
||||
].join('');
|
||||
throw new ServerlessError(errorMessage);
|
||||
}
|
||||
})();
|
||||
|
||||
this.serverless.service.provider.remoteFunctionData = result;
|
||||
return result;
|
||||
} catch {
|
||||
const errorMessage = [
|
||||
`The function "${this.options.function}" you want to update is not yet deployed.`,
|
||||
' Please run "serverless deploy" to deploy your service.',
|
||||
' After that you can redeploy your services functions with the',
|
||||
' "serverless deploy function" command.',
|
||||
].join('');
|
||||
throw new ServerlessError(errorMessage);
|
||||
}
|
||||
if (result) this.serverless.service.provider.remoteFunctionData = result;
|
||||
}
|
||||
|
||||
checkIfFunctionChangesBetweenImageAndHandler() {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user