Skip to content

chore(test-registry): Add more descriptive error code for common error #16790

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions dev-packages/e2e-tests/registrySetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,15 @@ export function registrySetup(): void {
},
);

if (publishImageContainerRunProcess.status !== 0) {
throw new Error('Publish Image Container failed.');
const statusCode = publishImageContainerRunProcess.status;

if (statusCode !== 0) {
if (statusCode === 137) {
throw new Error(
`Publish Image Container failed with exit code ${statusCode}, possibly due to memory issues. Consider increasing the memory limit for the container.`,
);
}
throw new Error(`Publish Image Container failed with exit code ${statusCode}`);
Comment on lines +88 to +96
Copy link

@bricefriha bricefriha Jul 2, 2025

Choose a reason for hiding this comment

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

I like the description, it's quite nice! 🙏🏼

For the sake of give my two cents: since throw won't will prevent the rest of the code to run, perhaps we may as well avoid the embedded if statements

Suggested change
const statusCode = publishImageContainerRunProcess.status;
if (statusCode !== 0) {
if (statusCode === 137) {
throw new Error(
`Publish Image Container failed with exit code ${statusCode}, possibly due to memory issues. Consider increasing the memory limit for the container.`,
);
}
throw new Error(`Publish Image Container failed with exit code ${statusCode}`);
const statusCode = publishImageContainerRunProcess.status;
if (statusCode !== 0) {
throw new Error(`Publish Image Container failed with exit code ${statusCode}`);
}
if (statusCode === 137) {
throw new Error(
`Publish Image Container failed with exit code ${statusCode}, possibly due to memory issues. Consider increasing the memory limit for the container.`,
);

It's not so much for the performance benefits (since that's for testing), but I find it easier to read, as far as I'm concerned 😁
Let me know if there is something I'm missing

}
});

Expand Down
Loading