convert define_exception from macro to metaprogramming