-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -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
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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
Suggested change
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 😁 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. With your suggestion, it would throw already in the first condition ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My bad, sorry, you're absolutely right, I don't know what I was thinking here. Ignore me, all good 😅 |
||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||
}); | ||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
l: I am never a big fan of having such nested if clauses :D Instead, what about doing something like this:
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a fan of nested if clauses either.
I really like your approach but what if we want to handle other specific status codes later?