Skip to content

Add logging before trying to inspect container - #643

Open
gustakasn0v wants to merge 1 commit into
MichelFR:mainfrom
gustakasn0v:main
Open

Add logging before trying to inspect container#643
gustakasn0v wants to merge 1 commit into
MichelFR:mainfrom
gustakasn0v:main

Conversation

@gustakasn0v

Copy link
Copy Markdown

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

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Comment on lines +531 to +533
logger.info(
`Inspecting container ${container.Name}`
);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

high

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.

Suggested change
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")
);

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.

1 participant