From c7725df7545749c8d3a4ef3b322a14d9371928c4 Mon Sep 17 00:00:00 2001 From: peefy Date: Sun, 30 Jun 2024 12:55:11 +0800 Subject: [PATCH] chore: update capi call error message Signed-off-by: peefy --- kclvm/api/Cargo.toml | 3 +++ kclvm/api/src/service/capi.rs | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/kclvm/api/Cargo.toml b/kclvm/api/Cargo.toml index fb9c980fe..8d53c50a3 100644 --- a/kclvm/api/Cargo.toml +++ b/kclvm/api/Cargo.toml @@ -45,3 +45,6 @@ criterion = "0.4.0" protoc-bin-vendored = "3.0.0" prost-build = "0.11.8" prost-wkt-build = {path = "../third-party/prost-wkt/wkt-build", version = "0.4.1"} + +[features] +llvm = ["kclvm-runner/llvm"] diff --git a/kclvm/api/src/service/capi.rs b/kclvm/api/src/service/capi.rs index ff5e76f5a..381ad1ca5 100644 --- a/kclvm/api/src/service/capi.rs +++ b/kclvm/api/src/service/capi.rs @@ -49,7 +49,7 @@ macro_rules! call { let res = serv_ref.$serv_name(&args); let result_byte = match res { Ok(res) => res.encode_to_vec(), - Err(err) => panic!("{}", err), + Err(err) => format!("ERROR:{}", err.to_string()).into_bytes(), }; *$result_len = result_byte.len(); CString::from_vec_unchecked(result_byte).into_raw()