replace console.error with just reject

pull/630/head
Pedro Sá 2021-06-09 16:46:39 +01:00
parent 85b651cc02
commit ae1c760af0
1 changed files with 14 additions and 15 deletions

View File

@ -206,10 +206,10 @@ export class OpenVidu {
// The request was made but no response was received // The request was made but no response was received
// `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); reject(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); reject(error.message);
} }
}); });
}); });
@ -259,10 +259,10 @@ export class OpenVidu {
} else if (error.request) { } else if (error.request) {
// The request was made but no response was received `error.request` is an instance of XMLHttpRequest // The request was made but no response was received `error.request` is an instance of XMLHttpRequest
// in the browser and an instance of http.ClientRequest in node.js // in the browser and an instance of http.ClientRequest in node.js
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); reject(new Error(error.message));
} }
}); });
}); });
@ -304,10 +304,10 @@ export class OpenVidu {
// The request was made but no response was received // The request was made but no response was received
// `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); 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); reject(new Error(error.message));
} }
}); });
}); });
@ -352,10 +352,10 @@ export class OpenVidu {
// The request was made but no response was received // The request was made but no response was received
// `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); 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); reject(new Error(error.message));
} }
}); });
}); });
@ -398,10 +398,10 @@ export class OpenVidu {
// The request was made but no response was received // The request was made but no response was received
// `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); 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); reject(new Error(error.message));
} }
}); });
}); });
@ -479,11 +479,11 @@ export class OpenVidu {
// The request was made but no response was received // The request was made but no response was received
// `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); reject(new Error(error.request));
reject(error); reject(error);
} 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); reject(new Error(error.message));
reject(new Error(error.message)); reject(new Error(error.message));
} }
}); });
@ -649,10 +649,10 @@ export class OpenVidu {
// The request was made but no response was received // The request was made but no response was received
// `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); 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); reject(new Error(error.message));
} }
}); });
}); });
@ -668,7 +668,6 @@ export class OpenVidu {
try { try {
url = new URL(this.hostname); url = new URL(this.hostname);
} catch (error) { } catch (error) {
console.error('URL format incorrect', error);
throw new Error('URL format incorrect: ' + error); throw new Error('URL format incorrect: ' + error);
} }
this.host = url.protocol + '//' + url.host; this.host = url.protocol + '//' + url.host;