Error Code/Messaging Protocol

Hello all,
I am feeling the need to develop an organized error code/messaging protocol. My apps are a combination of desktop and console with heavy internet usage. I also have in the “total project” a web app too. The issue comes in larger when the internet and console apps are in use. For example when a console or desktop app sends a request to a web server (running a console app) and the request is denied, or some error takes place - particularly one that is not a run-time error, good reporting back to the calling application needs to take place. Prior to recently, there was insignificant need for this, or so it appeared. Now however I have recognized that there is a much larger need for an organized method of creating error codes that can be sent to the calling app, and then changed to a more user friendly message.

Rather than reinvent the wheel, I thought there might be one or more examples on the web for said animal. However all I really found were classes for OS’s that did not appear to fit well. Has anyone developed such a beast, and if so be willing to share?

Thank you,