mirror of
https://github.com/gnmyt/myspeed.git
synced 2026-01-07 21:49:48 -06:00
Fixed an error when creating the speedtest in the absence of an internet connection
This commit is contained in:
@@ -20,12 +20,17 @@ module.exports.run = async () => {
|
||||
}
|
||||
|
||||
module.exports.create = async () => {
|
||||
let test = await this.run();
|
||||
let ping = Math.round(test.ping.latency);
|
||||
let download = roundSpeed(test.download.bytes, test.download.elapsed);
|
||||
let upload = roundSpeed(test.upload.bytes, test.upload.elapsed);
|
||||
let testResult = tests.create(ping, download, upload);
|
||||
console.log(`Test #${testResult} was executed successfully. 🏓 ${ping} ⬇ ${download}️ ⬆ ${upload}️`);
|
||||
try {
|
||||
let test = await this.run();
|
||||
let ping = Math.round(test.ping.latency);
|
||||
let download = roundSpeed(test.download.bytes, test.download.elapsed);
|
||||
let upload = roundSpeed(test.upload.bytes, test.upload.elapsed);
|
||||
let testResult = tests.create(ping, download, upload);
|
||||
console.log(`Test #${testResult} was executed successfully. 🏓 ${ping} ⬇ ${download}️ ⬆ ${upload}️`);
|
||||
} catch (e) {
|
||||
let testResult = tests.create(0, 0, 0);
|
||||
console.log(`Test #${testResult} was not executed successfully. Please try reconnecting to the internet or restarting the software.`);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports.removeOld = () => {
|
||||
|
||||
Reference in New Issue
Block a user