fix(prql): Robust panic handler

This commit is contained in:
Maximilian Roos 2024-02-29 17:43:06 -08:00
parent 0f6a1b451b
commit 1a5afa90a1
No known key found for this signature in database
GPG Key ID: 9058CC0B4BD47C30
2 changed files with 3 additions and 9 deletions

2
.gitignore vendored
View File

@ -165,7 +165,7 @@ tests/queries/0_stateless/*.expect.history
tests/integration/**/_gen
# rust
/rust/**/target
/rust/**/target*
# It is autogenerated from *.in
/rust/**/.cargo/config.toml
/rust/**/vendor

View File

@ -57,14 +57,8 @@ pub unsafe extern "C" fn prql_to_sql(
out: *mut *mut u8,
out_size: *mut u64,
) -> i64 {
let ret = panic::catch_unwind(|| {
return prql_to_sql_impl(query, size, out, out_size);
});
return match ret {
// NOTE: using cxxbridge we can return proper Result<> type.
Err(_err) => 1,
Ok(res) => res,
}
// NOTE: using cxxbridge we can return proper Result<> type.
panic::catch_unwind(|| prql_to_sql_impl(query, size, out, out_size)).unwrap_or(1)
}
#[no_mangle]