Skip to content

Commit 0bcef0b

Browse files
gnzjgoampcode-com
andcommitted
fix: show meaningful error messages instead of undefined on build/dev failures (#131)
Amp-Thread-ID: https://ampcode.com/threads/T-019d1b0d-6dca-7013-a8f8-af75363aae7d Co-authored-by: Amp <amp@ampcode.com>
1 parent 5665c22 commit 0bcef0b

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/api/build.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ export async function buildToTinybird(
223223
if (body.errors && body.errors.length > 0) {
224224
return body.errors.map(e => {
225225
const prefix = e.filename ? `[${e.filename}] ` : '';
226-
return `${prefix}${e.error}`;
226+
return `${prefix}${e.error ?? 'Unknown error'}`;
227227
}).join('\n');
228228
}
229229
return body.error || `HTTP ${response.status}: ${response.statusText}`;

src/cli/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,8 @@ function createCli(): Command {
541541
output.showBuildErrors(deploy.errors);
542542
} else if (result.error) {
543543
output.error(result.error);
544+
} else {
545+
output.error("Deploy failed (no error details available, run with TINYBIRD_DEBUG=1 for more info)");
544546
}
545547
output.showDeployFailure();
546548
process.exit(1);
@@ -732,6 +734,8 @@ function createCli(): Command {
732734
output.showBuildErrors(deploy.errors);
733735
} else if (result.error) {
734736
output.error(result.error);
737+
} else {
738+
output.error("Build failed (no error details available, run with TINYBIRD_DEBUG=1 for more info)");
735739
}
736740
output.showBuildFailure(true);
737741
return;

0 commit comments

Comments
 (0)