Skip to content

Commit

Permalink
session.js: improved error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
hbbio committed Dec 27, 2013
1 parent 4791be7 commit 1a8ed83
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions lib/plugins/server/session.js
Expand Up @@ -75,7 +75,7 @@ var LowLevelPingLoop = {};
var internal_url = base_url_client+"/_internal_/"+page_index;

var async_rpc_return = true;
/* If client is safari, we must force rpc to be synchronous */
/* If client is Safari, we must force rpc to be synchronous */
var hack = typeof(desactivate_safari_hack) == 'undefined' || !desactivate_safari_hack
if (hack && !command_line_execution && 'userAgent' in navigator){
var ua = navigator.userAgent;
Expand All @@ -101,10 +101,10 @@ var LowLevelPingLoop = {};
function generate_cl_id() {
var rand = random();
var c = getStableCookie();
if ( 'none' in c )
throw new Error("no cookie no session");
if ('none' in c)
throw new Error('Please make sure cookies are enabled. Cookies are required for sessions.');
else {
return ("" + rand + c.some);
return ('' + rand + c.some);
}
}
Expand All @@ -119,7 +119,7 @@ var LowLevelPingLoop = {};
var connection_lost_handlers = null;
function default_connection_lost_handler(){
jlog("Error: the connection with the server seems to be lost. Please reload");
jlog("Error: Connection lost. Please check your network status and reload the page.");
}
function break_ping_loop() {
Expand All @@ -142,14 +142,14 @@ var LowLevelPingLoop = {};
settings.url = domain_url + internal_url + settings.url;
if(to_register.length != 0){
var body = settings.data;
if (typeof body == 'undefined') body="";
if (typeof body == 'undefined') body='';
var data = {
to_register:to_register,
uri:settings.url,
body:body
};
settings.data = JSON.stringify(data);
settings.url = internal_url + "/chan/register";
settings.url = internal_url + '/chan/register';
to_register = new Array();
var success
if(settings.success){
Expand All @@ -159,7 +159,7 @@ var LowLevelPingLoop = {};
success = function () {}
}
settings.statusCode = { 205: break_ping_loop,
200: success};
200: success };
}
return jQuery.ajax(settings);
}
Expand All @@ -170,8 +170,6 @@ var LowLevelPingLoop = {};
/* ************************************************** */
/* Distant Channel ********************************** */
/**
Expand Down

0 comments on commit 1a8ed83

Please sign in to comment.