Skip to content

Fix maintenance mode API error handling and OpenAPI documentation#179

Draft
Copilot wants to merge 1 commit intodevelopfrom
copilot/sub-pr-178
Draft

Fix maintenance mode API error handling and OpenAPI documentation#179
Copilot wants to merge 1 commit intodevelopfrom
copilot/sub-pr-178

Conversation

Copy link
Copy Markdown

Copilot AI commented Feb 12, 2026

The maintenance mode REST endpoints had ineffective error handling and incorrect OpenAPI schema annotations based on automated code review feedback.

Changes:

  • Exception handling: Repository.getInstance().getComponent() throws IllegalArgumentException (doesn't return null), so replaced null checks with try-catch blocks to properly return error responses instead of 500s
  • OpenAPI schema: Fixed @ApiResponse annotations to declare ReplyObject.class instead of Boolean.class to match actual return type
  • Removed redundant operations: component.setMaintenanceMode() already updates the underlying ComponentConfig, so removed duplicate config.setMaintenanceMode() calls in enable/disable endpoints
// Before: ineffective null check
Component component = Repository.getInstance().getComponent(componentName);
if (component == null) {  // Never executed - getComponent() throws instead
    return ReplyObject.error("Component not found");
}

// After: proper exception handling
try {
    Component component = Repository.getInstance().getComponent(componentName);
    return ReplyObject.success("maintenanceMode", component.isMaintenanceMode());
} catch (IllegalArgumentException e) {
    return ReplyObject.error("Component not found: " + componentName);
}

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI mentioned this pull request Feb 12, 2026
Copilot AI changed the title [WIP] Add component maintenance mode feature for backend and UI Fix maintenance mode API error handling and OpenAPI documentation Feb 12, 2026
Copilot AI requested a review from dvayanu February 12, 2026 21:38
Base automatically changed from features/maintenanceModeComponent to develop February 12, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants