unified error response handling