DAR-2525 fixing bug introduced with too much JSHinting

Plus, additional, nicer errors
DAR-2525 Removing unnecessary variables
DAR-2525 Handle exception differently