Refactored the service gateway to expect an object containing the error details instead of a string