All JS connection errors now raised with error object
- Moved all error messages to central resources object
- Added simple private format function to allow for substitution into error messages
- Fixed tests affected by error change
- Fixed inconsistent if/else formatting
- #2345