Skip to content

Commit

Permalink
feat: add glue code for console_error_panic_hook
Browse files Browse the repository at this point in the history
- this allows for enabling of this hook in rust contracts

gh-309
  • Loading branch information
rpiszczatowski committed Mar 22, 2023
1 parent 51bcd56 commit 79e5c9c
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/core/modules/impl/wasm/rust-wasm-imports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal
return addHeapObject(ret);
}, arguments);
},
__wbg_new: function (arg0, arg1) {
__wbg_new_4: function (arg0, arg1) {
try {
var state0 = { a: arg0, b: arg1 };
var cb0 = (arg0, arg1) => {
Expand All @@ -263,6 +263,27 @@ export const rustWasmImports = (swGlobal, wbindgenImports, wasmInstance, dtorVal
state0.a = state0.b = 0;
}
},
__wbg_new_6: function() {
var ret = new Error();
return addHeapObject(ret);
},
__wbg_stack: function(arg0, arg1) {
let limit = Error.stackTraceLimit;
Error.stackTraceLimit = 25;
var ret = getObject(arg1).stack;
var ptr0 = passStringToWasm0(ret, wasmInstance.exports.__wbindgen_malloc, wasmInstance.exports.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
Error.stackTraceLimit = limit;
},
__wbg_error: function(arg0, arg1) {
try {
rawImports.console.log(getStringFromWasm0(arg0, arg1));
} finally {
wasmInstance.exports.__wbindgen_free(arg0, arg1);
}
},
__wbg_resolve: function (arg0) {
var ret = Promise.resolve(getObject(arg0));
return addHeapObject(ret);
Expand Down

0 comments on commit 79e5c9c

Please sign in to comment.