Refactor gateway error reporting to be more extensible
Add error parameter that includes the gateway error message