Closed jimasun closed 1 year ago
@jimasun I can see how this stacktrace might make it look like a Neon issue, but, it isn't.
I see two problems. The first is the sample code is not using the minifyHtml
method correctly. Reading the source, the options argument is a required field.
Try adding an empty object to your code.
return minifyHtml.minify(Buffer.from(`
<div class="lower-buttons">
<span class="next primary button disabled">Next</span>
</div>`), {})
Secondly, it looks like this library is mishandling the Throw
error. When this is present, a library should typically return early because it's invalid to call almost all Neon/Node APIs while in a throwing state.
However, the library is attempting to throw a new error after failing to get the original here:
There are a few different ways to handle this, but, one way is to catch the exception prior to re-throwing:
let Ok(opt) = cx.try_catch(|cx| cx.argument::<JsObject>(1)) else {
return cx.throw_type_error("the second argument is not an object");
};
Thank you for looking into it. The code was fixed on the plugin side.
Hey, I have tried to make use a plugin which is using Neon and I am getting this along the way. I've already posed an issue with the plugin () and they suggested to raise an issue here.
This is the code where I am using the specific plugin - correct as verified by the creator of it.
The result output in the console.