[Node.js] Fix assertion failure panic on invalid argument type.
This commit is contained in:
parent
c0f7ac99e1
commit
dc43362203
|
@ -1,5 +1,9 @@
|
|||
# minify-html changelog
|
||||
|
||||
## Pending
|
||||
|
||||
- [Node.js] Fix assertion failure panic on invalid argument type.
|
||||
|
||||
## 0.10.7
|
||||
|
||||
- Bump [minify-js](https://github.com/wilsonzlin/minify-js) to 0.4.2.
|
||||
|
|
|
@ -15,4 +15,4 @@ minify-html = "0.10.7"
|
|||
[dependencies.neon]
|
||||
version = "0.10"
|
||||
default-features = false
|
||||
features = ["napi-1"]
|
||||
features = ["napi-1", "try-catch-api"]
|
||||
|
|
|
@ -2,10 +2,10 @@ use neon::prelude::*;
|
|||
use neon::types::buffer::TypedArray;
|
||||
|
||||
fn minify(mut cx: FunctionContext) -> JsResult<JsBuffer> {
|
||||
let Ok(src) = cx.argument::<JsBuffer>(0) else {
|
||||
let Ok(src) = cx.try_catch(|cx| cx.argument::<JsBuffer>(0)) else {
|
||||
return cx.throw_type_error("the first argument is not a Buffer");
|
||||
};
|
||||
let Ok(opt) = cx.argument::<JsObject>(1) else {
|
||||
let Ok(opt) = cx.try_catch(|cx| cx.argument::<JsObject>(1)) else {
|
||||
return cx.throw_type_error("the second argument is not an object");
|
||||
};
|
||||
let cfg = minify_html::Cfg {
|
||||
|
|
Loading…
Reference in New Issue