reject connection failures in Session.ts

pull/105/merge
pabloFuente 2018-09-03 09:54:21 +02:00
parent b2ec6a00e7
commit 0cddbbf745
1 changed files with 12 additions and 0 deletions

View File

@ -127,9 +127,11 @@ export class Session {
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js // http.ClientRequest in node.js
console.error(error.request); console.error(error.request);
reject(new Error(error.request));
} else { } else {
// Something happened in setting up the request that triggered an Error // Something happened in setting up the request that triggered an Error
console.error('Error', error.message); console.error('Error', error.message);
reject(new Error(error.message));
} }
}); });
}); });
@ -170,9 +172,11 @@ export class Session {
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js // http.ClientRequest in node.js
console.error(error.request); console.error(error.request);
reject(new Error(error.request));
} else { } else {
// Something happened in setting up the request that triggered an Error // Something happened in setting up the request that triggered an Error
console.error('Error', error.message); console.error('Error', error.message);
reject(new Error(error.message));
} }
}); });
}); });
@ -218,9 +222,11 @@ export class Session {
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js // http.ClientRequest in node.js
console.error(error.request); console.error(error.request);
reject(new Error(error.request));
} else { } else {
// Something happened in setting up the request that triggered an Error // Something happened in setting up the request that triggered an Error
console.error('Error', error.message); console.error('Error', error.message);
reject(new Error(error.message));
} }
}); });
}); });
@ -285,9 +291,11 @@ export class Session {
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js // http.ClientRequest in node.js
console.error(error.request); console.error(error.request);
reject(new Error(error.request));
} else { } else {
// Something happened in setting up the request that triggered an Error // Something happened in setting up the request that triggered an Error
console.error('Error', error.message); console.error('Error', error.message);
reject(new Error(error.message));
} }
}); });
}); });
@ -338,9 +346,11 @@ export class Session {
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js // http.ClientRequest in node.js
console.error(error.request); console.error(error.request);
reject(new Error(error.request));
} else { } else {
// Something happened in setting up the request that triggered an Error // Something happened in setting up the request that triggered an Error
console.error('Error', error.message); console.error('Error', error.message);
reject(new Error(error.message));
} }
}); });
}); });
@ -398,9 +408,11 @@ export class Session {
// `error.request` is an instance of XMLHttpRequest in the browser and an instance of // `error.request` is an instance of XMLHttpRequest in the browser and an instance of
// http.ClientRequest in node.js // http.ClientRequest in node.js
console.error(error.request); console.error(error.request);
reject(new Error(error.request));
} else { } else {
// Something happened in setting up the request that triggered an Error // Something happened in setting up the request that triggered an Error
console.error('Error', error.message); console.error('Error', error.message);
reject(new Error(error.message));
} }
}); });
}); });