Skip to content

Commit

Permalink
fix: Satisfy new sonarcloud rules
Browse files Browse the repository at this point in the history
  • Loading branch information
Hypfer committed May 10, 2023
1 parent 33d43e7 commit c306028
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 9 deletions.
10 changes: 7 additions & 3 deletions backend/lib/NTPClient.js
Expand Up @@ -44,7 +44,7 @@ class NTPClient {
this.state = new States.ValetudoNTPClientEnabledState({});

if (this.config.get("embedded") === true) {
this.pollTime().then(() => {
this.pollTime().catch(() => {
/* intentional */
});
}
Expand Down Expand Up @@ -84,7 +84,9 @@ class NTPClient {
Logger.debug("Next NTP sync in " + ntpConfig.interval + " ms");

this.nextPollTimeout = setTimeout(() => {
this.pollTime();
this.pollTime().catch(() => {
/* intentional */
});
}, ntpConfig.interval);
} catch (e) {
let error = {
Expand Down Expand Up @@ -126,7 +128,9 @@ class NTPClient {
Logger.debug("Next NTP sync in " + FAILURE_RETRY_INTERVAL + " ms");

this.nextPollTimeout = setTimeout(() => {
this.pollTime();
this.pollTime().catch(() => {
/* intentional */
});
}, FAILURE_RETRY_INTERVAL);
}
}
Expand Down
4 changes: 4 additions & 0 deletions backend/lib/miio/Dummycloud.js
Expand Up @@ -58,6 +58,8 @@ class Dummycloud {
"firsttest": 1193
}
}
}).catch(e => {
Logger.warn(`Error while responding to ${msg.method}`, e);
});
return;
case "_async.stat":
Expand All @@ -66,6 +68,8 @@ class Dummycloud {
this.miioSocket.sendMessage({
"id": msg.id,
"result": "ok"
}).catch(e => {
Logger.warn(`Error while responding to ${msg.method}`, e);
});
return;
}
Expand Down
5 changes: 0 additions & 5 deletions backend/lib/miio/MiioSocket.js
Expand Up @@ -226,11 +226,6 @@ class MiioSocket {
});
}

/** Sends a ping / keepalive message. */
sendPing() {
this.sendMessage(null);
}

/**
* @param {(msg: import("./DecodedMiioPacket")) => void} fn
*/
Expand Down
2 changes: 2 additions & 0 deletions backend/lib/mqtt/MqttController.js
Expand Up @@ -363,6 +363,8 @@ class MqttController {
this.robotHandle.refresh().catch(err => {
Logger.error("Error during MQTT handle refresh", err);
});
}).catch(e => {
Logger.error("Error on MQTT reconfigure state change", e);
});
}).catch(e => {
Logger.error("Error on MQTT reconfigure", e);
Expand Down
2 changes: 2 additions & 0 deletions backend/lib/robots/MiioValetudoRobot.js
Expand Up @@ -572,6 +572,8 @@ class MiioValetudoRobot extends ValetudoRobot {
if (!parsedMap) {
Logger.warn("Failed to parse uploaded map");
}
}).catch(e => {
Logger.warn("Failed to preprocess uploaded map");
});
}

Expand Down
10 changes: 9 additions & 1 deletion backend/lib/robots/roborock/RoborockValetudoRobot.js
Expand Up @@ -112,6 +112,8 @@ class RoborockValetudoRobot extends MiioValetudoRobot {
case "_sync.getctrycode":
this.sendCloud({
id: msg.id, result: {ctry_code: "DE"} //TODO
}).catch(e => {
Logger.warn(`Error while responding to ${msg.method}`, e);
});

return true;
Expand All @@ -122,8 +124,11 @@ class RoborockValetudoRobot extends MiioValetudoRobot {
code: -6,
message: "not set app data"
}
}).catch(e => {
Logger.warn(`Error while responding to ${msg.method}`, e);
});


return true;
// Roborock does not use the common presigned URL implementation, it requires this specific format.
case "_sync.gen_tmp_presigned_url":
Expand All @@ -147,7 +152,10 @@ class RoborockValetudoRobot extends MiioValetudoRobot {
}
}

this.sendCloud({id: msg.id, result: mapUploadUrls});
this.sendCloud({id: msg.id, result: mapUploadUrls}).catch(e => {
Logger.warn(`Error while responding to ${msg.method}`, e);
});


return true;
}
Expand Down
4 changes: 4 additions & 0 deletions frontend/src/map/Map.tsx
Expand Up @@ -211,12 +211,16 @@ abstract class Map<P, S> extends React.Component<P & MapProps, S & MapState > {

this.updateDrawableComponents().then(() => {
this.draw();
}).catch(() => {
/* intentional */
});
}

protected redrawLayers() : void {
this.mapLayerManager.draw(this.props.rawMap, this.props.theme).then(() => {
this.draw();
}).catch(() => {
/* intentional */
});
}

Expand Down

0 comments on commit c306028

Please sign in to comment.