felixguendling / cista

Cista is a simple, high-performance, zero-copy C++ serialization & reflection library.
https://cista.rocks
MIT License
1.78k stars 113 forks source link

Feature request: specialize exceptions to cista #155

Closed AdelKS closed 1 year ago

AdelKS commented 1 year ago

Hello,

Specializing exceptions that cista throws would be very nice to be able to tell them apart from other kinds of exceptions through specialized catch clauses. For example a cista::deserialize_error("Invalid type hash") will enable to not abort the program when simply trying to deserialize.

What do you think ?

Currently there still is the possibility to do this downstream, by try-catching cista calls and rethrowing specialized exceptions down the stack.

Adel

felixguendling commented 1 year ago

This sounds reasonable. Thank you for your proposal!

felixguendling commented 1 year ago

https://github.com/felixguendling/cista/pull/158 introduces basic support for catching exceptions coming from cista. Please create a new issue if you require more detailed distinction between exceptions. Thank you for bringing this up!

AdelKS commented 1 year ago

Thanks for your great work ! That's already plenty.