Skip to content
This repository has been archived by the owner on Jul 12, 2022. It is now read-only.

Handle template error #1107

Merged
merged 24 commits into from
Apr 28, 2021
Merged

Conversation

thallesfreitaszup
Copy link
Contributor

@thallesfreitaszup thallesfreitaszup commented Apr 27, 2021

Issue Description

Generic error message when helm template is invalid

Solution

Catch exception and implement a filter to format the error

Results

Old Response

{
  "statusCode": 500,
  "message": "Internal server error"
}

New Response


{
    "errors": [
        {
            "title": "Not valid template. Error: template: dragonboarding/templates/deployment.yaml:4:21: executing \"dragonboarding/templates/deployment.yaml\" at <.ValuesBAD.deploymentName>: nil pointer evaluating interface {}.deploymentName\n\nUse --debug flag to render out invalid YAML\n",
            "meta": {
                "component": "butler",
                "timestamp": 1619480467886
            },
            "status": 400
        }
    ]
}```

Signed-off-by: thalles <lopthalles@gmail.com>
…into fix-lint-tests

Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
@boring-cyborg boring-cyborg bot added the butler Improvements/additions/fixes for butler module. label Apr 27, 2021
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
@codecov
Copy link

codecov bot commented Apr 27, 2021

Codecov Report

Merging #1107 (baf1c9c) into butler-operator (15e4430) will decrease coverage by 0.15%.
The diff coverage is 77.52%.

❗ Current head baf1c9c differs from pull request most recent head e0d8431. Consider uploading reports for the commit e0d8431 to get more accurate results
Impacted file tree graph

@@                  Coverage Diff                  @@
##             butler-operator    #1107      +/-   ##
=====================================================
- Coverage              77.66%   77.50%   -0.16%     
- Complexity              2164     2177      +13     
=====================================================
  Files                   1259     1233      -26     
  Lines                  17552    17485      -67     
  Branches                1608     1598      -10     
=====================================================
- Hits                   13631    13552      -79     
- Misses                  3436     3448      +12     
  Partials                 485      485              
Flag Coverage Δ Complexity Δ
butler 83.60% <88.80%> (-2.51%) 0.00 <0.00> (ø)
moove 75.50% <86.66%> (+0.36%) 1658.00 <12.00> (+13.00)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ Complexity Δ
...pi/deployments/controller/executions.controller.ts 100.00% <ø> (ø) 0.00 <0.00> (ø)
...on/request/CreateDeploymentConfigurationRequest.kt 100.00% <ø> (+100.00%) 6.00 <0.00> (+6.00)
...oove/infrastructure/service/DeployClientService.kt 97.56% <0.00%> (-2.44%) 7.00 <0.00> (ø)
...ure/service/client/response/HealthCheckResponse.kt 0.00% <0.00%> (ø) 0.00 <0.00> (?)
.../src/core/assets/themes/circleDeploymentHistory.ts 100.00% <ø> (ø) 0.00 <0.00> (ø)
ui/src/core/components/Dropdown/Item/index.tsx 88.88% <ø> (-1.12%) 0.00 <0.00> (ø)
ui/src/core/components/Modal/FullScreen/styled.ts 44.44% <ø> (ø) 0.00 <0.00> (ø)
ui/src/core/components/Page/constants.ts 100.00% <ø> (ø) 0.00 <0.00> (ø)
ui/src/core/utils/date.ts 74.19% <ø> (+1.46%) 0.00 <0.00> (ø)
...odules/Circles/Comparation/Item/History/helpers.ts 14.28% <ø> (-1.10%) 0.00 <0.00> (ø)
... and 154 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bd20d53...e0d8431. Read the comment docs.

@thallesfreitaszup thallesfreitaszup changed the base branch from main to butler-operator April 27, 2021 12:56
Signed-off-by: thalles <lopthalles@gmail.com>
@boring-cyborg boring-cyborg bot added the moove Improvements/additions/fixes for moove module. label Apr 27, 2021
@thallesfreitaszup thallesfreitaszup changed the base branch from butler-operator to main April 27, 2021 13:18
@thallesfreitaszup thallesfreitaszup marked this pull request as ready for review April 27, 2021 13:20
@thallesfreitaszup thallesfreitaszup changed the base branch from main to butler-operator April 27, 2021 13:21
Comment on lines 57 to 60
private alreadyDetailedError(response: string | Record<string, unknown>): boolean {
return typeof response !== 'string' && Object.keys(response).some(
(key) => key === 'errors')
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Wouldn't be better to refactor all occurrences of this error structure instead of filtering them here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, i will do this!

}

export class ErrorResponse {
public message: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

No semicolons. Run npm run lint

Comment on lines 99 to 100
}
] }
Copy link
Contributor

Choose a reason for hiding this comment

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

Indent. Run npm run lint

Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
@thallesfreitaszup thallesfreitaszup changed the base branch from butler-operator to main April 27, 2021 20:20
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
@thallesfreitaszup thallesfreitaszup changed the base branch from main to butler-operator April 27, 2021 21:38
Signed-off-by: thalles <lopthalles@gmail.com>
Signed-off-by: thalles <lopthalles@gmail.com>
@thallesfreitaszup thallesfreitaszup merged commit 57f9967 into butler-operator Apr 28, 2021
@thallesfreitaszup thallesfreitaszup deleted the handle-template-error branch April 28, 2021 13:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
butler Improvements/additions/fixes for butler module. moove Improvements/additions/fixes for moove module.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants