Bug 71686: Added try/catch to prevent rendering 500 error page. Also added 4...

...00 error code to prevent bad requests.