Introduce some helper macros to test integer overflow from arithmetic and set error message appropriately.