diff --git a/package.json b/package.json index 79d1607..9fbc57f 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "unplugin-https-reverse-proxy", "type": "module", - "version": "2.0.1", + "version": "2.0.2", "description": "", "license": "MIT", "homepage": "https://github.com/zcf0508/unplugin-https-reverse-proxy#readme", diff --git a/src/caddy/index.ts b/src/caddy/index.ts index b9e1627..47b0eed 100644 --- a/src/caddy/index.ts +++ b/src/caddy/index.ts @@ -324,18 +324,22 @@ ${target.split(':')[0]}${https ? '' : ':80'} { // caddy log // eslint-disable-next-line no-console showCaddyLog && line && console.info(line) - if (line.includes('Error:') || (line && JSON.parse(line).level === 'error')) { - if (line.includes('parsing caddyfile tokens')) { - consola.error('Caddyfile syntax error, please contact the author:\n', `${this.caddyfile}\n\n${line}\n`) - await this.baseCleanup() - process.exit() - } - else { - consola.error(`${line}\n`) - // child.kill() - return reject(line) + try { + if (line.includes('Error:') || (line && JSON.parse(line).level === 'error')) { + if (line.includes('parsing caddyfile tokens')) { + consola.error('Caddyfile syntax error, please contact the author:\n', `${this.caddyfile}\n\n${line}\n`) + await this.baseCleanup() + process.exit() + } + else { + consola.error(`${line}\n`) + // child.kill() + return reject(line) + } } } + catch {} + if (line.includes('config file changed')) consola.success('Detect added a new reverse proxy config, restarted.\n')