3
0
Fork 0
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:
Kevin Gibbons 2022-04-24 03:04:08 -07:00 committed by GitHub
parent 39f57fb7ca
commit 312e037458
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 83 additions and 18 deletions

View file

@ -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);