@quantovainc/qcore 0.1.20 → 0.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/shared.js +4 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantovainc/qcore",
3
- "version": "0.1.20",
3
+ "version": "0.1.21",
4
4
  "description": "Quantova's post quantum client core for JavaScript. Signs with ML-DSA-65 and builds Q1 addresses.",
5
5
  "scripts": {
6
6
  "build": "RUSTFLAGS=\"--remap-path-prefix=$HOME/quantova-stack=/qcore --remap-path-prefix=$HOME/.cargo=/cargo --remap-path-prefix=$HOME/.rustup=/rustup\" wasm-pack build --target bundler --out-dir pkg && RUSTFLAGS=\"--remap-path-prefix=$HOME/quantova-stack=/qcore --remap-path-prefix=$HOME/.cargo=/cargo --remap-path-prefix=$HOME/.rustup=/rustup\" wasm-pack build --target nodejs --out-dir pkg-node",
package/shared.js CHANGED
@@ -221,7 +221,10 @@ function makeClient(core) {
221
221
  const text = await readBounded(res);
222
222
  let data;
223
223
  try { data = JSON.parse(text); } catch { throw new Error('the node returned a non JSON response'); }
224
- if (!res.ok) throw new Error(data.message || data.error || ('status ' + res.status));
224
+ if (!res.ok) {
225
+ const detail = data && typeof data === 'object' ? (data.message || data.error) : null;
226
+ throw new Error(detail || ('status ' + res.status));
227
+ }
225
228
  return data;
226
229
  } finally {
227
230
  clearTimeout(timer);