From d0183d4a636316750a8a9f33972fa8359b8247a0 Mon Sep 17 00:00:00 2001 From: "soar.gy" Date: Thu, 23 Mar 2023 14:41:46 +0800 Subject: [PATCH] chore: opti more error message --- packages/cli-plugin-fc/src/index.ts | 10 ++++++++++ packages/cli-plugin-package/src/index.ts | 8 ++++++++ 2 files changed, 18 insertions(+) diff --git a/packages/cli-plugin-fc/src/index.ts b/packages/cli-plugin-fc/src/index.ts index 94999074..8591962b 100644 --- a/packages/cli-plugin-fc/src/index.ts +++ b/packages/cli-plugin-fc/src/index.ts @@ -208,6 +208,16 @@ export class AliyunFCPlugin extends BasePlugin { this.getStore('artifactFile', 'global') || join(this.servicePath, 'serverless.zip'); + if (!syaml[access].AccountID) { + console.error( + 'Parse servrelessDevs config error, there is a high probability that ak error' + ); + this.core.debug('syaml', syaml); + throw new Error( + `ServerlessDevs AccountId corresponding to ${access} does not exist` + ); + } + const akId = Crypto.AES.decrypt( syaml[access].AccountID, 'SecretKey123' diff --git a/packages/cli-plugin-package/src/index.ts b/packages/cli-plugin-package/src/index.ts index 701ef7a5..2383d101 100644 --- a/packages/cli-plugin-package/src/index.ts +++ b/packages/cli-plugin-package/src/index.ts @@ -906,6 +906,14 @@ export class PackagePlugin extends BasePlugin { delete this.core.service.functions[functionName]; } }); + const notFoundFnuction = functions.filter(functoinName => { + return !this.core.service.functions[functoinName]; + }); + if (notFoundFnuction.length) { + throw new Error( + `The specified functions ${notFoundFnuction.join(', ')} do not exist.` + ); + } } async package() {