Skip to content

Commit

Permalink
Improve run build error message (#553)
Browse files Browse the repository at this point in the history
  • Loading branch information
dario-piotrowicz authored Nov 28, 2023
1 parent 733fed9 commit b7f9225
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/fast-masks-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@cloudflare/next-on-pages': patch
---

improve unhelpful error message (so that instead of `[object Object]` it prints the actual error message)
6 changes: 5 additions & 1 deletion packages/next-on-pages/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,11 @@ function runBuild(options: CliOptions) {
`);
}
}
}).catch(error => cliError(`Watch mode unexpected error: ${error}`));
}).catch(error => {
const errorMessage =
error instanceof Error ? error.message : JSON.stringify(error);
cliError(`Unexpected error: ${errorMessage}`);
});
}

function setWatchMode(fn: () => void): void {
Expand Down

0 comments on commit b7f9225

Please sign in to comment.