From d0b8758224594fcb858588ba3a9585e5dbc60809 Mon Sep 17 00:00:00 2001 From: jiasheng Date: Fri, 16 Jan 2026 07:59:29 +0800 Subject: [PATCH] fix: enhance error tracking for unhandled exceptions and datasource URL evaluation --- package.json | 2 +- src/index.ts | 3 +++ src/zmodel-parser.ts | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 95cda05..40bb59d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@zenstackhq/proxy", - "version": "0.2.3", + "version": "0.2.4", "description": "A CLI tool to run an Express server that proxies CRUD requests to a ZenStack backend", "main": "index.js", "publishConfig": { diff --git a/src/index.ts b/src/index.ts index 93d4712..3f1730f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -67,11 +67,14 @@ export default async function () { // ignore exitCode = e.exitCode } else if (e instanceof CliError) { + telemetry.trackError(e) console.error(red(e.message)) } else { if (e instanceof Error) { + telemetry.trackError(e) console.error(red(`Unhandled error: ${e.message}`)) } else { + telemetry.trackError(new Error(String(e))) console.error(red(`Unhandled error: ${String(e)}`)) } } diff --git a/src/zmodel-parser.ts b/src/zmodel-parser.ts index 67813f4..d406a99 100644 --- a/src/zmodel-parser.ts +++ b/src/zmodel-parser.ts @@ -132,6 +132,9 @@ function parseDatasource( const urlFn = new Function('env', `return ${urlValueStr}`) url = urlFn(env) } catch (evalError) { + if (evalError instanceof CliError) { + throw evalError + } throw new CliError( 'Could not evaluate datasource url from schema, you could provide it via -d option.' )