Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[minor] Throw a human readable error if the client has not been compi…

…led correctly
  • Loading branch information...
commit eeaefe32b3536ad77ff50bd29777747617d18831 1 parent 448ae3f
@lpinca lpinca authored
Showing with 11 additions and 6 deletions.
  1. +11 −6 primus.js
View
17 primus.js
@@ -231,6 +231,11 @@ try {
*/
function Primus(url, options) {
if (!(this instanceof Primus)) return new Primus(url, options);
+ if ('function' !== typeof this.client) {
+ var message = 'The client library has not been compiled correctly, ' +
+ 'see https://github.com/primus/primus#client-library for more details';
+ return this.critical(new Error(message));
+ }
if ('object' === typeof url) {
options = url;
@@ -405,12 +410,12 @@ try {
// and guess at a value from the 'href' value
//
if (!data.port) {
- if (!data.href) data.href = '';
- if ((data.href.match(/\:/g) || []).length > 1) {
- data.port = data.href.split(':')[2].split('/')[0];
- } else {
- data.port = ('https' === data.href.substr(0, 5)) ? 443 : 80;
- }
+ if (!data.href) data.href = '';
+ if ((data.href.match(/\:/g) || []).length > 1) {
+ data.port = data.href.split(':')[2].split('/')[0];
+ } else {
+ data.port = ('https' === data.href.substr(0, 5)) ? 443 : 80;
+ }
}
//
Please sign in to comment.
Something went wrong with that request. Please try again.