We do this quite a bit in the Arrow<->Parquet bridge if IIUC. There are macros defined like this:
``` #define BEGIN_PARQUET_CATCH_EXCEPTIONS try { #define END_PARQUET_CATCH_EXCEPTIONS \ } \ catch (const ::parquet::ParquetStatusException& e) { \ return e.status(); \ } \ catch (const ::parquet::ParquetException& e) { \ return ::arrow::Status::IOError(e.what()); \ } ``` That being said, I'm not particularly fond of macros, but it works. On Thu, Jun 29, 2023 at 8:09 AM Li Jin <ice.xell...@gmail.com> wrote: > Thanks Antoine - the examples are useful - I can use the same pattern for > now. Thanks for the quick response! > > On Thu, Jun 29, 2023 at 10:47 AM Antoine Pitrou <anto...@python.org> > wrote: > > > > > Hi Li, > > > > There is not currently, but it would probably be a useful small utility. > > If you look for `std::exception` in the codebase, you'll find that there > > a couple of places where we turn it into a Status already. > > > > Regards > > > > Antoine. > > > > > > Le 29/06/2023 à 16:20, Li Jin a écrit : > > > Hi, > > > > > > IIUC, most of the Arrow C++ code doesn't not use exceptions. My > question > > is > > > are there some Arrow utility / macro that wrap the function/code that > > might > > > raise an exception and turn that into code that returns an arrow error > > > Status? > > > > > > Thanks! > > > Li > > > > > >