Skip to content

Commit

Permalink
handlebars-templates: Improve "caused by" stack trace from handlebars…
Browse files Browse the repository at this point in the history
… templates
  • Loading branch information
karlvr committed Nov 23, 2023
1 parent b6d16d9 commit 1f8b503
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/twenty-plums-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@openapi-generator-plus/handlebars-templates": patch
---

Improve "caused by" stack trace from handlebars templates
2 changes: 1 addition & 1 deletion packages/handlebars-templates/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export async function emit(templateName: string, outputPath: string, context: Un
if (error instanceof Error) {
const newError = new Error(`Failed to generate template "${templateName}": ${error.message}`)
/* Use the original stack so we can see where we failed */
newError.stack = `${newError.stack}\nCaused by ${error.stack}`
newError.stack = `${newError.stack}\n Caused by ${error.stack}`
throw newError
} else {
throw new Error(`Failed to generate template "${templateName}": ${error}`)
Expand Down

0 comments on commit 1f8b503

Please sign in to comment.