Add logging before trying to inspect container - #643
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces an informational log statement to output the name of the container being inspected in HomeassistantService.ts. The reviewer suggests adding defensive checks to ensure container and container.Config are defined before accessing their properties, which prevents potential runtime crashes.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| logger.info( | ||
| `Inspecting container ${container.Name}` | ||
| ); |
There was a problem hiding this comment.
To prevent potential runtime crashes (e.g., TypeError: Cannot read properties of undefined), we should defensively check if container is defined and has the expected properties before logging and accessing its configuration. Since this PR is specifically aimed at diagnosing/preventing crashes, adding a robust guard check here is highly recommended.
| logger.info( | |
| `Inspecting container ${container.Name}` | |
| ); | |
| if (!container || !container.Config) { | |
| logger.warn("Container or container configuration is missing"); | |
| return; | |
| } | |
| logger.info( | |
| "Inspecting container " + (container.Name || "unknown") | |
| ); |
Due to #258 MqDockerUp crashes when it tries to parse certain image tag formats (eg. Immich tags). This PR adds a log that helps identify the image that caused the crash