Exit on Node.js assertion failures
This commit is contained in:
parent
b1968e539d
commit
de41c79092
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue