We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 44060f6 commit 5d555d3Copy full SHA for 5d555d3
src/utils/vpc.js
@@ -1,3 +1,5 @@
1
+const { ApiTypeError } = require('tencent-component-toolkit/lib/utils/error')
2
+
3
/**
4
* 自然数级别的区间计算库;也可用于字符串区间(直接使用字符串对比),但此时不支持区间减法。
5
* nature number ranges calculate library, also support string ranges without subtraction.
@@ -232,8 +234,10 @@ function getAvailableCidr(
232
234
})
233
235
236
const [avalableZone] = totalRang.ranges
-
- return `${uintToIp(avalableZone[0])}/29`
237
+ if (avalableZone) {
238
+ return `${uintToIp(avalableZone[0])}/29`
239
+ }
240
+ throw new ApiTypeError(`GET_AVAILABLE_CIDR`, `Can not get available CIDR for VPC ${vpcCIDR}.`)
241
}
242
243
module.exports = {
0 commit comments