Skip to content

Commit 418719e

Browse files
committed
fix(scf): error throw
1 parent 551072e commit 418719e

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/baas/scf/index.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ class Scf {
236236
console.log(`Deploying ${inputs.name}'s triggers in ${this.region}.`)
237237

238238
if ((await this.checkStatus(inputs.namespace || defaultNamespace, inputs.name)) == false) {
239-
throw `Deploying ${inputs.name} trigger failed. Please check function status.`
239+
throw new Error(`Deploying ${inputs.name} trigger failed. Please check function status.`)
240240
}
241241

242242
const releaseEvents = funcInfo.Triggers
@@ -353,7 +353,9 @@ class Scf {
353353
inputs.name
354354
)
355355
if (functionStatus == false) {
356-
throw `Function ${inputs.name} deploy trigger failed. Please check function status.`
356+
throw new Error(
357+
`Function ${inputs.name} deploy trigger failed. Please check function status.`
358+
)
357359
}
358360

359361
// 判断Trigger是否已经存在
@@ -469,7 +471,7 @@ class Scf {
469471
} else {
470472
await this.updateFunctionCode(inputs, funcInfo)
471473
if ((await this.checkStatus(inputs.namespace || defaultNamespace, inputs.name)) == false) {
472-
throw `Function ${inputs.name} upgrade failed. Please check function status.`
474+
throw new Error(`Function ${inputs.name} upgrade failed. Please check function status.`)
473475
}
474476
await this.updateFunctionConfigure(inputs, funcInfo)
475477
}
@@ -484,7 +486,7 @@ class Scf {
484486
funcInfo = await this.getFunction(inputs.namespace || defaultNamespace, inputs.name)
485487
}
486488
if ((await this.checkStatus(inputs.namespace || defaultNamespace, inputs.name)) == false) {
487-
throw `Function ${inputs.name} upgrade failed. Please check function status.`
489+
throw new Error(`Function ${inputs.name} upgrade failed. Please check function status.`)
488490
}
489491
await Promise.all([this.deployTags(funcInfo, inputs), this.deployTrigger(funcInfo, inputs)])
490492
}

0 commit comments

Comments
 (0)