捕获配置转换的异常

pull/448/head
王良 2025-02-07 16:01:03 +08:00
parent 64d5ae5e8b
commit b80547944b
1 changed files with 16 additions and 12 deletions

View File

@ -32,6 +32,7 @@ function domainMapRegexply (hostMap) {
const regexpMap = {}
const origin = {} // 用于快速匹配见matchHostname、matchHostnameAll方法
lodash.each(hostMap, (value, domain) => {
try {
// 将域名匹配串格式如 `.xxx.com` 转换为 `*.xxx.com`
if (domain[0] === '.') {
if (hostMap[`*${domain}`] != null) {
@ -50,6 +51,9 @@ function domainMapRegexply (hostMap) {
} else {
origin[domain] = value
}
} catch (e) {
log.error('匹配串有问题:', domain, e)
}
})
regexpMap.origin = origin
return regexpMap