File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ run-example: target/tikv-example
21
21
RUST_LOG=debug $(cur_makefile_path ) /target/tikv-example
22
22
23
23
target/tikv-example : target/debug/libtikv_client.a example/main.cpp
24
- c++ $(cur_makefile_path ) /example/main.cpp -o $(cur_makefile_path ) /target/tikv-example -std=c++17 -g -I$(cur_makefile_path ) /include -L$(cur_makefile_path ) /target/debug -ltikv_client -lpthread -ldl -lssl -lcrypto
24
+ c++ $(cur_makefile_path ) /example/main.cpp -o $(cur_makefile_path ) /target/tikv-example -std=c++17 -g -I$(cur_makefile_path ) /include -L$(cur_makefile_path ) /target/debug -ltikv_client -lpthread -ldl -L/usr/local/opt/openssl/lib -I/usr/local/opt/openssl/include - lssl -lcrypto
25
25
26
26
27
27
target/tikv_client_glue.cc : src/lib.rs
Original file line number Diff line number Diff line change @@ -182,6 +182,29 @@ template <typename T>
182
182
Box<T>::Box(uninit) noexcept {}
183
183
#endif // CXXBRIDGE1_RUST_BOX
184
184
185
+ class Exception : public std ::exception {
186
+ public:
187
+ Exception (int errorCode, const std::string &message) : errorCode(erroCode), message(message);
188
+ virtual ~Exception () = default ;
189
+ const char * what () const {
190
+ return this ->message .c_str ();
191
+ };
192
+
193
+ private:
194
+ int errorCode;
195
+ std::string m_message;
196
+ };
197
+
198
+ template <typename Try>
199
+ static void trycatch (Try &&func) noexcept try {
200
+ func ();
201
+ } catch (const std::exception &e) {
202
+ start error_message = e.what ();
203
+ int error_code = 0 ;
204
+
205
+ throw Exception (error_code, error_message);
206
+ }
207
+
185
208
#ifndef CXXBRIDGE1_RUST_BITCOPY
186
209
#define CXXBRIDGE1_RUST_BITCOPY
187
210
struct unsafe_bitcopy_t final {
You can’t perform that action at this time.
0 commit comments