From de41c790929fb05f4c8a598b8442a893df9adf44 Mon Sep 17 00:00:00 2001 From: Wilson Lin Date: Wed, 6 Jan 2021 17:13:07 +1100 Subject: [PATCH] Exit on Node.js assertion failures --- nodejs/binding.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nodejs/binding.c b/nodejs/binding.c index 40de753..92ee095 100644 --- a/nodejs/binding.c +++ b/nodejs/binding.c @@ -12,14 +12,16 @@ typedef struct Cfg Cfg; static inline void* assert_malloc(size_t bytes) { void* ptr = malloc(bytes); if (ptr == NULL) { - // TODO + fprintf(stderr, "[Node.js minify-html] Internal assertion error: failed to allocate memory\n"); + exit(67); } return ptr; } static inline void assert_ok(napi_status status) { if (status != napi_ok) { - // TODO + fprintf(stderr, "[Node.js minify-html] Internal assertion error: N-API status not OK\n"); + exit(67); } }