You could try setting up your own handler for the onerror event and use XMLHttpRequest to tell the server what went wrong, however since it's not part of any specification, support is somewhat flaky.
If you're wanting to log the client-side errors back to the server you're going to have to do some kind of server processing. Best bet would be to have a web service which you can access via JavaScript (AJAX) and you pass your error log info to it.
Doesn't 100% solve the problem cuz if the problem is with the web server hosting the web service you're in trouble, you're other option would be to send the info via a standard page via a query string, One method of doing that is via dynamically generating Image tags (which are then removed) as the browser will try and load the source of an image. It gets around cross-domain JavaScript calls nicely though. Keep in mind that you're in trouble if someone has images turned off ;)
I have just implemented server side error logging on javascript errors on a project at work. There is a mixture of legacy code and new code using jQuery.
Longer answer: People have already written about how you can (at least partially) solve this issue by writing your own code. However, do note that there are services out there that seems to have made sure the JS code needed works in many browsers. I've found the following: