Hello Rajiv,
you define an exception type and raise this exception in the server proxy with the respective exception message. Find example coding here:
Reporting and Handling Errors - Enabling Application-to-Application Processes - SAP Library
Regards,
Jörg