Add macros for error and exception registration