Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent backend from crashing if no inspectionArea #2046

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Eddasol
Copy link
Contributor

@Eddasol Eddasol commented Feb 24, 2025

Ready for review checklist:

  • A self-review has been performed
  • All commits run individually
  • Temporary changes have been removed, like console.log, TODO, etc.
  • The PR has been tested locally
  • A test have been written
    • This change doesn't need a new test
  • Relevant issues are linked
  • Remaining work is documented in issues
    • There is no remaining work from this PR that require new issues
  • The changes does not introduce dead code as unused imports, functions etc.

@Eddasol Eddasol self-assigned this Feb 24, 2025
@Eddasol Eddasol added bug Something isn't working backend Backend related functionality labels Feb 24, 2025
@@ -157,7 +157,7 @@ private async void OnSendRobotToDockTriggered(object? sender, RobotEmergencyEven
{
await MissionScheduling.ScheduleMissionToDriveToDockPosition(robot.Id);
}
catch (DockException ex)
catch (Exception ex) when (ex is DockException || ex is InspectionAreaNotFoundException)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We usually split the expceptions, like this, for consistency:

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can do it, but the logging and behavior is the same so it would mean duplicated line 161-172. Do you prefer splitting it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, we do this in the mapService as well

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The looging messages are different tho, one is regarding docking and the other inspection area so i think it is worth it to duplicate it, it is also consistent with most of the code we have. You don't have to because its a preference but for consistency i think it would be good

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer this. Less chance of getting bugs where only one of the exceptions have forgotten a return or a signalR message

@Eddasol Eddasol force-pushed the dock-causeing-crash branch 2 times, most recently from 0d44f20 to 864b49e Compare February 26, 2025 09:21
@Eddasol Eddasol force-pushed the dock-causeing-crash branch from 864b49e to 13166a6 Compare February 28, 2025 07:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backend Backend related functionality bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backend crashes if clicking "Send robots to dock" when robot doesn't have inspection area
2 participants