Skip to content

Commit d0b8758

Browse files
committed
fix: enhance error tracking for unhandled exceptions and datasource URL evaluation
1 parent 13b76e0 commit d0b8758

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/proxy",
3-
"version": "0.2.3",
3+
"version": "0.2.4",
44
"description": "A CLI tool to run an Express server that proxies CRUD requests to a ZenStack backend",
55
"main": "index.js",
66
"publishConfig": {

src/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,14 @@ export default async function () {
6767
// ignore
6868
exitCode = e.exitCode
6969
} else if (e instanceof CliError) {
70+
telemetry.trackError(e)
7071
console.error(red(e.message))
7172
} else {
7273
if (e instanceof Error) {
74+
telemetry.trackError(e)
7375
console.error(red(`Unhandled error: ${e.message}`))
7476
} else {
77+
telemetry.trackError(new Error(String(e)))
7578
console.error(red(`Unhandled error: ${String(e)}`))
7679
}
7780
}

src/zmodel-parser.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ function parseDatasource(
132132
const urlFn = new Function('env', `return ${urlValueStr}`)
133133
url = urlFn(env)
134134
} catch (evalError) {
135+
if (evalError instanceof CliError) {
136+
throw evalError
137+
}
135138
throw new CliError(
136139
'Could not evaluate datasource url from schema, you could provide it via -d option.'
137140
)

0 commit comments

Comments
 (0)