HANDLE JAVASCRIPT AND PHP ERRORS GRACEFULLY.