@@ -24,20 +24,20 @@ async function getConfigFunctions() {
2424 if ( ! config . functions ||
2525 ! Array . isArray ( config . functions ) ||
2626 ! config . functions . length ) {
27- throw new error_1 . TcbError ( '函数配置不存在' ) ;
27+ throw new error_1 . CloudBaseError ( '函数配置不存在' ) ;
2828 }
2929 const { functions } = config ;
3030 functions . forEach ( func => {
3131 if ( ! func . name ) {
32- throw new error_1 . TcbError ( '云函数名称不能为空' ) ;
32+ throw new error_1 . CloudBaseError ( '云函数名称不能为空' ) ;
3333 }
3434 if ( typeof func . config . timeout !== 'undefined' ) {
3535 const timeout = Number ( func . config . timeout ) ;
3636 if ( ! Number . isInteger ( timeout ) ) {
37- throw new error_1 . TcbError ( '超时时间必需为整数' ) ;
37+ throw new error_1 . CloudBaseError ( '超时时间必需为整数' ) ;
3838 }
3939 if ( timeout < 1 || timeout > 20 ) {
40- throw new error_1 . TcbError ( '超时时间有效值为: 1~20S' ) ;
40+ throw new error_1 . CloudBaseError ( '超时时间有效值为: 1~20S' ) ;
4141 }
4242 }
4343 } ) ;
@@ -62,7 +62,7 @@ commander_1.default
6262 } ) ;
6363 isBatchCreating = isBatch ;
6464 if ( ! isBatchCreating ) {
65- throw new error_1 . TcbError ( '请指定部署函数名称!' ) ;
65+ throw new error_1 . CloudBaseError ( '请指定部署函数名称!' ) ;
6666 }
6767 }
6868 if ( isBatchCreating ) {
@@ -76,7 +76,7 @@ commander_1.default
7676 }
7777 const newFunction = functions . find ( item => item . name === name ) ;
7878 if ( ! newFunction || ! newFunction . name ) {
79- throw new error_1 . TcbError ( `函数 ${ name } 配置不存在` ) ;
79+ throw new error_1 . CloudBaseError ( `函数 ${ name } 配置不存在` ) ;
8080 }
8181 const createSpinner = ora_1 . default ( '函数部署中...' ) . start ( ) ;
8282 try {
@@ -126,11 +126,11 @@ commander_1.default
126126 const config = await utils_1 . resolveCloudBaseConfig ( ) ;
127127 const functions = await getConfigFunctions ( ) ;
128128 if ( ! name ) {
129- throw new error_1 . TcbError ( '请指定函数名称!' ) ;
129+ throw new error_1 . CloudBaseError ( '请指定函数名称!' ) ;
130130 }
131131 const func = functions . find ( item => item . name === name ) ;
132132 if ( ! func || ! func . name ) {
133- throw new error_1 . TcbError ( `函数 ${ name } 配置不存在` ) ;
133+ throw new error_1 . CloudBaseError ( `函数 ${ name } 配置不存在` ) ;
134134 }
135135 const spinner = ora_1 . default ( `[${ func . name } ] 函数代码更新中...` ) . start ( ) ;
136136 try {
@@ -156,10 +156,10 @@ commander_1.default
156156 limit = Number ( limit ) ;
157157 offset = Number ( offset ) ;
158158 if ( ! Number . isInteger ( limit ) || ! Number . isInteger ( offset ) ) {
159- throw new error_1 . TcbError ( 'limit 和 offset 必须为整数' ) ;
159+ throw new error_1 . CloudBaseError ( 'limit 和 offset 必须为整数' ) ;
160160 }
161161 if ( limit < 0 || offset < 0 ) {
162- throw new error_1 . TcbError ( 'limit 和 offset 必须为大于 0 的整数' ) ;
162+ throw new error_1 . CloudBaseError ( 'limit 和 offset 必须为大于 0 的整数' ) ;
163163 }
164164 const assignEnvId = await utils_1 . getEnvId ( envId ) ;
165165 const data = await function_1 . listFunction ( {
@@ -208,7 +208,7 @@ commander_1.default
208208 isBatchDelete = reConfirm ;
209209 }
210210 if ( ! isBatchDelete ) {
211- throw new error_1 . TcbError ( '请指定需要删除的云函数名称!' ) ;
211+ throw new error_1 . CloudBaseError ( '请指定需要删除的云函数名称!' ) ;
212212 }
213213 }
214214 if ( isBatchDelete ) {
@@ -311,21 +311,21 @@ commander_1.default
311311 const assignEnvId = await utils_1 . getEnvId ( envId ) ;
312312 let { offset, limit, order, orderBy, error, success, startTime, endTime, reqId : functionRequestId } = options ;
313313 if ( ! name ) {
314- throw new error_1 . TcbError ( '云函数名称不能为空' ) ;
314+ throw new error_1 . CloudBaseError ( '云函数名称不能为空' ) ;
315315 }
316316 const TimeLength = 19 ;
317317 if ( typeof startTime !== 'undefined' &&
318318 typeof endTime !== 'undefined' &&
319319 ( startTime . length !== TimeLength || endTime . length !== TimeLength ) ) {
320- throw new error_1 . TcbError ( '时间格式错误,必须为 2019-05-16 20:59:59 类型' ) ;
320+ throw new error_1 . CloudBaseError ( '时间格式错误,必须为 2019-05-16 20:59:59 类型' ) ;
321321 }
322322 if ( new Date ( endTime ) . getTime ( ) < new Date ( startTime ) . getTime ( ) ) {
323- throw new error_1 . TcbError ( '开始时间不能晚于结束时间' ) ;
323+ throw new error_1 . CloudBaseError ( '开始时间不能晚于结束时间' ) ;
324324 }
325325 const OneDay = 86400000 ;
326326 if ( new Date ( endTime ) . getTime ( ) - new Date ( startTime ) . getTime ( ) >
327327 OneDay ) {
328- throw new error_1 . TcbError ( 'endTime 与 startTime 只能相差一天之内' ) ;
328+ throw new error_1 . CloudBaseError ( 'endTime 与 startTime 只能相差一天之内' ) ;
329329 }
330330 let params = {
331331 offset,
@@ -386,7 +386,7 @@ commander_1.default
386386 } ) ;
387387 isBathUpdate = isBatch ;
388388 if ( ! isBathUpdate ) {
389- throw new error_1 . TcbError ( '请指定云函数名称!' ) ;
389+ throw new error_1 . CloudBaseError ( '请指定云函数名称!' ) ;
390390 }
391391 }
392392 const functions = await getConfigFunctions ( ) ;
@@ -400,7 +400,7 @@ commander_1.default
400400 }
401401 const functionItem = functions . find ( item => item . name === name ) ;
402402 if ( ! functionItem ) {
403- throw new error_1 . TcbError ( '未找到相关函数配置,请检查函数名是否正确' ) ;
403+ throw new error_1 . CloudBaseError ( '未找到相关函数配置,请检查函数名是否正确' ) ;
404404 }
405405 await function_1 . updateFunctionConfig ( {
406406 functionName : name ,
@@ -424,7 +424,7 @@ commander_1.default
424424 } ) ;
425425 isBatchCreateTrigger = isBatch ;
426426 if ( ! isBatchCreateTrigger ) {
427- throw new error_1 . TcbError ( '请指定云函数名称!' ) ;
427+ throw new error_1 . CloudBaseError ( '请指定云函数名称!' ) ;
428428 }
429429 }
430430 const functions = await getConfigFunctions ( ) ;
@@ -436,11 +436,11 @@ commander_1.default
436436 }
437437 const functionItem = functions . find ( item => item . name === name ) ;
438438 if ( ! functionItem ) {
439- throw new error_1 . TcbError ( '未找到相关函数配置,请检查函数名是否正确' ) ;
439+ throw new error_1 . CloudBaseError ( '未找到相关函数配置,请检查函数名是否正确' ) ;
440440 }
441441 const { triggers } = functionItem ;
442442 if ( ! triggers || ! triggers . length ) {
443- throw new error_1 . TcbError ( '触发器配置不能为空' ) ;
443+ throw new error_1 . CloudBaseError ( '触发器配置不能为空' ) ;
444444 }
445445 await function_1 . createFunctionTriggers ( {
446446 functionName : name ,
@@ -473,7 +473,7 @@ commander_1.default
473473 isBtachDeleteTriggers = reConfirm ;
474474 }
475475 if ( ! isBtachDeleteTriggers ) {
476- throw new error_1 . TcbError ( '请指定云函数名称以及触发器名称!' ) ;
476+ throw new error_1 . CloudBaseError ( '请指定云函数名称以及触发器名称!' ) ;
477477 }
478478 }
479479 if ( isBtachDeleteTriggers ) {
@@ -492,7 +492,7 @@ commander_1.default
492492 } ) ;
493493 isBatchDeleteFunctionTriggers = isBatch ;
494494 if ( ! isBatchDeleteFunctionTriggers ) {
495- throw new error_1 . TcbError ( '请指定云函数名称以及触发器名称!' ) ;
495+ throw new error_1 . CloudBaseError ( '请指定云函数名称以及触发器名称!' ) ;
496496 }
497497 }
498498 if ( isBatchDeleteFunctionTriggers ) {
@@ -504,7 +504,7 @@ commander_1.default
504504 } ) ;
505505 }
506506 if ( ! triggerName ) {
507- throw new error_1 . TcbError ( '触发器名称不能为空' ) ;
507+ throw new error_1 . CloudBaseError ( '触发器名称不能为空' ) ;
508508 }
509509 function_1 . deleteFunctionTrigger ( {
510510 functionName,
@@ -527,7 +527,7 @@ commander_1.default
527527 } ) ;
528528 isBatchInvoke = isBatch ;
529529 if ( ! isBatchInvoke ) {
530- throw new error_1 . TcbError ( '请指定云函数名称!' ) ;
530+ throw new error_1 . CloudBaseError ( '请指定云函数名称!' ) ;
531531 }
532532 }
533533 let params ;
@@ -537,7 +537,7 @@ commander_1.default
537537 }
538538 catch ( e ) {
539539 console . log ( e ) ;
540- throw new error_1 . TcbError ( 'jsonStringParams 参数不是正确的 JSON 字符串' ) ;
540+ throw new error_1 . CloudBaseError ( 'jsonStringParams 参数不是正确的 JSON 字符串' ) ;
541541 }
542542 }
543543 const functions = await getConfigFunctions ( ) ;
@@ -550,7 +550,7 @@ commander_1.default
550550 }
551551 const func = functions . find ( item => item . name === name ) ;
552552 if ( ! func ) {
553- throw new error_1 . TcbError ( '未找到相关函数配置,请检查函数名是否正确' ) ;
553+ throw new error_1 . CloudBaseError ( '未找到相关函数配置,请检查函数名是否正确' ) ;
554554 }
555555 const result = await function_1 . invokeFunction ( {
556556 functionName : name ,
@@ -568,7 +568,7 @@ commander_1.default
568568 const assignEnvId = await utils_1 . getEnvId ( envId ) ;
569569 const { force } = options ;
570570 if ( ! functionName || ! newFunctionName ) {
571- throw new error_1 . TcbError ( '请指定函数名称!' ) ;
571+ throw new error_1 . CloudBaseError ( '请指定函数名称!' ) ;
572572 }
573573 await function_1 . copyFunction ( {
574574 force,
0 commit comments