mirror of
https://github.com/Z3Prover/z3
synced 2025-07-19 10:52:02 +00:00
wasm build: disable error handler (#5996)
* wasm: set error handler to no-op * wasm: better wrapper for use in html
This commit is contained in:
parent
39f57fb7ca
commit
312e037458
8 changed files with 83 additions and 18 deletions
|
@ -1,4 +1,4 @@
|
|||
import { init } from './build/wrapper';
|
||||
import { init, Z3_error_code } from './build/node-wrapper';
|
||||
|
||||
// demonstrates use of the raw API
|
||||
|
||||
|
@ -47,6 +47,16 @@ import { init } from './build/wrapper';
|
|||
console.log(Z3.query_constructor(ctx, nil_con, 0));
|
||||
console.log(Z3.query_constructor(ctx, cons_con, 2));
|
||||
|
||||
if (Z3.get_error_code(ctx) !== Z3_error_code.Z3_OK) {
|
||||
throw new Error('something failed: ' + Z3.get_error_msg(ctx, Z3.get_error_code(ctx)));
|
||||
}
|
||||
await Z3.eval_smtlib2_string(ctx, '(simplify)');
|
||||
if (Z3.get_error_code(ctx) === Z3_error_code.Z3_OK) {
|
||||
throw new Error('expected call to eval_smtlib2_string with invalid argument to fail');
|
||||
}
|
||||
console.log('confirming error messages work:', Z3.get_error_msg(ctx, Z3.get_error_code(ctx)));
|
||||
|
||||
|
||||
Z3.dec_ref(ctx, strAst);
|
||||
Z3.del_context(ctx);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue