Skip to content
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

v1/internal: refactor GetComposeStatus improve error handling #1324

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mgold1234
Copy link
Contributor

this commit improve error handling and code structure

  • Split GetComposeStatus into smaller, more focused functions
  • Enhance error handling with more specific HTTP status codes *Add dedicated functions for handling different response scenarios
  • Implement parseAndRedactComposeRequest for better separation of concerns
  • Improve code readability and maintainability

Copy link

codecov bot commented Aug 29, 2024

Codecov Report

Attention: Patch coverage is 65.71429% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/v1/handler.go 65.71% 7 Missing and 5 partials ⚠️
Files with missing lines Coverage Δ
internal/v1/handler.go 69.28% <65.71%> (+0.37%) ⬆️

@mgold1234 mgold1234 force-pushed the imporve_get_compose_status_func branch from 1f37e93 to 17e1d2c Compare September 2, 2024 09:22
Copy link
Contributor

@schuellerf schuellerf left a comment

Choose a reason for hiding this comment

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

While this makes the functions smaller and more readable
it duplicates the number of requests (calling h.getComposeByIdAndOrgId(ctx, composeId) twice now)?
If I'm right - this should be optimized to avoid duplicating the number of external requests

@mgold1234 mgold1234 force-pushed the imporve_get_compose_status_func branch from 17e1d2c to 2c6fd00 Compare September 2, 2024 11:47
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Thank you, I'm not familiar with the image-builder codebase so please take my review with a grain of salt. I have some suggestions inline about structure and naming though that are maybe/hopefully helpful :)

internal/v1/handler.go Outdated Show resolved Hide resolved
internal/v1/handler.go Show resolved Hide resolved
internal/v1/handler.go Outdated Show resolved Hide resolved
internal/v1/handler.go Outdated Show resolved Hide resolved
@mgold1234 mgold1234 force-pushed the imporve_get_compose_status_func branch from 7079a25 to 3852b9e Compare October 1, 2024 11:54
@mgold1234 mgold1234 requested a review from mvo5 October 1, 2024 11:55
@mgold1234 mgold1234 force-pushed the imporve_get_compose_status_func branch 2 times, most recently from ab51f06 to 9b4a036 Compare October 8, 2024 08:35
Copy link
Contributor

@mvo5 mvo5 left a comment

Choose a reason for hiding this comment

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

Thank you and sorry that it took me so long to look at this! This looks nice, some tiny naming/code organisation suggestions inline for your consideration.

internal/v1/handler.go Outdated Show resolved Hide resolved
internal/v1/handler.go Outdated Show resolved Hide resolved
@mgold1234 mgold1234 force-pushed the imporve_get_compose_status_func branch from 9b4a036 to 8e3471f Compare October 14, 2024 11:02
…ode structure

this commit improve error handling and code structure
* Split GetComposeStatus into smaller, more focused functions
* Enhance error handling with more specific HTTP status codes
*Add dedicated functions for handling different response scenarios
* Implement parseAndRedactComposeRequest for better separation of concerns
* Improve code readability and maintainability
@mgold1234 mgold1234 force-pushed the imporve_get_compose_status_func branch from 8e3471f to f55a3b2 Compare October 14, 2024 11:02
@mgold1234 mgold1234 requested a review from mvo5 October 14, 2024 11:02
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.

3 participants