From ff53257a1641ae5829edbd6dd22aaa6c9b0e7048 Mon Sep 17 00:00:00 2001 From: Markus Ast Date: Sat, 22 Jul 2023 12:33:26 +0200 Subject: [PATCH] fix unhandled promise rejection in .asBuffer() Refs #312 --- CHANGELOG.md | 4 ++++ lib/document.js | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 551fff3..9ef0ba6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] ### Fixed +- Fixed unhandled promise rejection in `doc.asBuffer()` + +## [2.5.0] +### Fixed - Fixed footer position after changing it #283 - Fixed graphical state not reset hwen using templates (could lead to rotated/translated pages) #287 - Fixed importing fonts in ESM context (in TS projects) #309 diff --git a/lib/document.js b/lib/document.js index 70e4752..1e3e9ca 100644 --- a/lib/document.js +++ b/lib/document.js @@ -653,7 +653,7 @@ class Document extends Readable { this.on("end", () => resolve(Buffer.concat(chunks))); this.on("error", reject); if (shouldEnd) { - this.end(); + return this.end(); } }); if (typeof callback === "function") {