The window.onerror handler catches Javascript errors in Chrome 13+, Firefox 6.0+, Internet Explorer 5.5+, Opera 11.60+ and Safari 5.1+. There’s already a really good answer on StackOverflow which provides a lot of information about it. It does not catch failures to load resources, though.
As far as other elements (such as images) are concerned, jQuery provides an .error() method to attach an error event handler to alert the user when an image or external script fails to load. If you can’t use jQuery, then another option is to preload all images / external resources via XMLHttpRequest and listen to the status (the HTTP response code) of the request (anything other than 200 OK or 304 Not Modified is something you’ll want to return an error). The downside to this is that, since event handlers and such have to be attached before the page is fully loaded, anyone who has JavaScript disabled is going to be looking at a fragmented, possibly blank page.
Invalid URIs and HTTP errors are best handled server-side. A well-formed .htaccess file, combined with Apache’s mod_rewrite (or an equivalent) can provide a lot of cushioning for bad requests to the server.