added error handling for java throwable, error 404, and error 500 exceptions