syoyo / tinydng

Header-only Tiny DNG/TIFF loader and writer in C++
MIT License
146 stars 30 forks source link

replacing asserts and throwing std::runtime_error exceptions instead #5

Closed wkjarosz closed 6 years ago

wkjarosz commented 6 years ago

Defined a macros TINY_DNG_ASSERT, to replace the previous assert(...) calls. This macros tests the same condition, but throws an std::runtime_error exception instead of terminating the program. These exceptions can be caught by the calling code to more gracefully recover.

syoyo commented 6 years ago

Thanks! merged.

syoyo commented 6 years ago

FYI, added TINY_DNG_NO_EXCEPTION define to support an environment with no C++ exceptions. https://github.com/syoyo/tinydngloader/commit/2cb6f935773d4afb295b2e31287ecc61135786c3