return JSON error to see what went wrong
This commit is contained in:
parent
3efb84e0e7
commit
3cfe92cea9
3 changed files with 71 additions and 64 deletions
|
|
@ -30,6 +30,69 @@ function getStringFromWasm0(ptr, len) {
|
||||||
return decodeText(ptr, len);
|
return decodeText(ptr, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let WASM_VECTOR_LEN = 0;
|
||||||
|
|
||||||
|
const cachedTextEncoder = new TextEncoder();
|
||||||
|
|
||||||
|
if (!('encodeInto' in cachedTextEncoder)) {
|
||||||
|
cachedTextEncoder.encodeInto = function (arg, view) {
|
||||||
|
const buf = cachedTextEncoder.encode(arg);
|
||||||
|
view.set(buf);
|
||||||
|
return {
|
||||||
|
read: arg.length,
|
||||||
|
written: buf.length
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function passStringToWasm0(arg, malloc, realloc) {
|
||||||
|
|
||||||
|
if (realloc === undefined) {
|
||||||
|
const buf = cachedTextEncoder.encode(arg);
|
||||||
|
const ptr = malloc(buf.length, 1) >>> 0;
|
||||||
|
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
||||||
|
WASM_VECTOR_LEN = buf.length;
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
let len = arg.length;
|
||||||
|
let ptr = malloc(len, 1) >>> 0;
|
||||||
|
|
||||||
|
const mem = getUint8ArrayMemory0();
|
||||||
|
|
||||||
|
let offset = 0;
|
||||||
|
|
||||||
|
for (; offset < len; offset++) {
|
||||||
|
const code = arg.charCodeAt(offset);
|
||||||
|
if (code > 0x7F) break;
|
||||||
|
mem[ptr + offset] = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (offset !== len) {
|
||||||
|
if (offset !== 0) {
|
||||||
|
arg = arg.slice(offset);
|
||||||
|
}
|
||||||
|
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
||||||
|
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
||||||
|
const ret = cachedTextEncoder.encodeInto(arg, view);
|
||||||
|
|
||||||
|
offset += ret.written;
|
||||||
|
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
WASM_VECTOR_LEN = offset;
|
||||||
|
return ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
let cachedDataViewMemory0 = null;
|
||||||
|
|
||||||
|
function getDataViewMemory0() {
|
||||||
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
||||||
|
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
||||||
|
}
|
||||||
|
return cachedDataViewMemory0;
|
||||||
|
}
|
||||||
|
|
||||||
function isLikeNone(x) {
|
function isLikeNone(x) {
|
||||||
return x === undefined || x === null;
|
return x === undefined || x === null;
|
||||||
}
|
}
|
||||||
|
|
@ -99,69 +162,6 @@ function debugString(val) {
|
||||||
return className;
|
return className;
|
||||||
}
|
}
|
||||||
|
|
||||||
let WASM_VECTOR_LEN = 0;
|
|
||||||
|
|
||||||
const cachedTextEncoder = new TextEncoder();
|
|
||||||
|
|
||||||
if (!('encodeInto' in cachedTextEncoder)) {
|
|
||||||
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
||||||
const buf = cachedTextEncoder.encode(arg);
|
|
||||||
view.set(buf);
|
|
||||||
return {
|
|
||||||
read: arg.length,
|
|
||||||
written: buf.length
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function passStringToWasm0(arg, malloc, realloc) {
|
|
||||||
|
|
||||||
if (realloc === undefined) {
|
|
||||||
const buf = cachedTextEncoder.encode(arg);
|
|
||||||
const ptr = malloc(buf.length, 1) >>> 0;
|
|
||||||
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
||||||
WASM_VECTOR_LEN = buf.length;
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
let len = arg.length;
|
|
||||||
let ptr = malloc(len, 1) >>> 0;
|
|
||||||
|
|
||||||
const mem = getUint8ArrayMemory0();
|
|
||||||
|
|
||||||
let offset = 0;
|
|
||||||
|
|
||||||
for (; offset < len; offset++) {
|
|
||||||
const code = arg.charCodeAt(offset);
|
|
||||||
if (code > 0x7F) break;
|
|
||||||
mem[ptr + offset] = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (offset !== len) {
|
|
||||||
if (offset !== 0) {
|
|
||||||
arg = arg.slice(offset);
|
|
||||||
}
|
|
||||||
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
||||||
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
||||||
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
||||||
|
|
||||||
offset += ret.written;
|
|
||||||
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
WASM_VECTOR_LEN = offset;
|
|
||||||
return ptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
let cachedDataViewMemory0 = null;
|
|
||||||
|
|
||||||
function getDataViewMemory0() {
|
|
||||||
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
||||||
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
||||||
}
|
|
||||||
return cachedDataViewMemory0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function addToExternrefTable0(obj) {
|
function addToExternrefTable0(obj) {
|
||||||
const idx = wasm.__externref_table_alloc();
|
const idx = wasm.__externref_table_alloc();
|
||||||
wasm.__wbindgen_externrefs.set(idx, obj);
|
wasm.__wbindgen_externrefs.set(idx, obj);
|
||||||
|
|
@ -235,6 +235,13 @@ function __wbg_get_imports() {
|
||||||
const ret = Error(getStringFromWasm0(arg0, arg1));
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
||||||
return ret;
|
return ret;
|
||||||
};
|
};
|
||||||
|
imports.wbg.__wbg_String_8f0eb39a4a4c2f66 = function(arg0, arg1) {
|
||||||
|
const ret = String(arg1);
|
||||||
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
||||||
|
const len1 = WASM_VECTOR_LEN;
|
||||||
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
||||||
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
||||||
|
};
|
||||||
imports.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
|
imports.wbg.__wbg___wbindgen_boolean_get_6d5a1ee65bab5f68 = function(arg0) {
|
||||||
const v = arg0;
|
const v = arg0;
|
||||||
const ret = typeof(v) === 'boolean' ? v : undefined;
|
const ret = typeof(v) === 'boolean' ? v : undefined;
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -52,7 +52,7 @@ pub fn eval_boolean(s: &str, js_trace: JsValue) -> JsValue {
|
||||||
// convert input (a sequence of state-objects) to a Trace that argus accepts:
|
// convert input (a sequence of state-objects) to a Trace that argus accepts:
|
||||||
let trace: StateBuddyTrace = match from_value(js_trace) {
|
let trace: StateBuddyTrace = match from_value(js_trace) {
|
||||||
Ok(trace) => trace,
|
Ok(trace) => trace,
|
||||||
Err(e) => return JsValue::from_str("failed to parse JSON"),
|
Err(e) => return JsValue::from_str(("failed to parse JSON: ".to_owned() + &e.to_string()).as_str()),
|
||||||
};
|
};
|
||||||
let mut traceMap = HashMap::<&str, Signal<f64>>::new();
|
let mut traceMap = HashMap::<&str, Signal<f64>>::new();
|
||||||
for entry in &trace.entries {
|
for entry in &trace.entries {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue