added macro to render api errors