centralized exception handling macros (avoid repeated definition in different files)