Skip to content

Commit

Permalink
Make error messages less verbose
Browse files Browse the repository at this point in the history
  • Loading branch information
Hal-9k1 committed Feb 27, 2025
1 parent 7d31adf commit 68d5d46
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
12 changes: 11 additions & 1 deletion src/main/MainApp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,11 +330,21 @@ export default class MainApp implements MenuHandler, RuntimeCommsListener {

onRuntimeTcpError(err: Error) {
if (!this.#suppressNetworkErrors) {
const rawMsg = err.toString();
const msg = `Encountered TCP error when communicating with Runtime. ${rawMsg}`;
if (rawMsg.includes('ETIMEDOUT')) {
msg = "Can't find the robot! Please make sure you are connected to the robot's router.";

Check failure on line 336 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

'msg' is constant

Check failure on line 336 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Insert `⏎·········`

Check failure on line 336 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

'msg' is constant

Check failure on line 336 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Insert `⏎·········`
} else if (rawMsg.includes('ENETUNREACH')) {
msg = "Can't find the robot! Please make sure the robot is turned on and you are connected"

Check failure on line 338 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

'msg' is constant

Check failure on line 338 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Replace `·"Can't·find·the·robot!·Please·make·sure·the·robot·is·turned·on·and·you·are·connected"⏎··········+` with `⏎··········"Can't·find·the·robot!·Please·make·sure·the·robot·is·turned·on·and·you·are·connected"·+⏎·········`

Check failure on line 338 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

'msg' is constant

Check failure on line 338 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Replace `·"Can't·find·the·robot!·Please·make·sure·the·robot·is·turned·on·and·you·are·connected"⏎··········+` with `⏎··········"Can't·find·the·robot!·Please·make·sure·the·robot·is·turned·on·and·you·are·connected"·+⏎·········`
+ " to the robot's router.";
} else if (rawMsg.includes('ENOTFOUND')) {
msg = "The robot ip is invalid. Please specify a valid ip.";

Check failure on line 341 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

'msg' is constant

Check failure on line 341 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

'msg' is assigned a value but never used

Check failure on line 341 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Replace `"The·robot·ip·is·invalid.·Please·specify·a·valid·ip."` with `'The·robot·ip·is·invalid.·Please·specify·a·valid·ip.'`

Check failure on line 341 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

'msg' is constant

Check failure on line 341 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

'msg' is assigned a value but never used

Check failure on line 341 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Replace `"The·robot·ip·is·invalid.·Please·specify·a·valid·ip."` with `'The·robot·ip·is·invalid.·Please·specify·a·valid·ip.'`
}
this.#sendToRenderer(
'renderer-post-console',
new AppConsoleMessage(

Check failure on line 345 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Replace `⏎··········'dawn-err',⏎··········ms⏎········` with `'dawn-err',·ms`

Check failure on line 345 in src/main/MainApp.ts

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest)

Replace `⏎··········'dawn-err',⏎··········ms⏎········` with `'dawn-err',·ms`
'dawn-err',
`Encountered TCP error when communicating with Runtime. ${err.toString()}`,
ms
),
);
}
Expand Down
7 changes: 0 additions & 7 deletions src/renderer/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,6 @@ export default function App() {
fieldIPAddress,
fieldStationNumber,
});
setConsoleMsgs((old) => [
...old,
new AppConsoleMessage(
'dawn-info',
`Connection config, robot ip: ${robotIPAddress}`,
),
]);
},
[IPAddress, FieldIPAddress, FieldStationNum],
);
Expand Down

0 comments on commit 68d5d46

Please sign in to comment.