Added exception handling to JS compiler.