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

Fix: Error message for GetResult handler #346

Merged
merged 1 commit into from
Mar 25, 2023

Conversation

sayan-biswas
Copy link
Contributor

@sayan-biswas sayan-biswas commented Feb 8, 2023

Fixes #337

Fix error message for GetResult handler.

Current: Shows wrapped RPC error message
{"code":5, "message":"failed to query on database: rpc error: code = NotFound desc = record not found", "details":[]}

Expected: Standard message
{"code":5, "message":"record not found", "details":[]}

Release Note

Fix GetResult to return the standard "record not found" error if the database query does not find a result.

@tekton-robot tekton-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Feb 8, 2023
@alan-ghelardi
Copy link
Contributor

🙈

@alan-ghelardi
Copy link
Contributor

/approve

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 8, 2023
Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

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

/approve

Copy link
Contributor

@khrm khrm left a comment

Choose a reason for hiding this comment

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

/kind bug

@tekton-robot tekton-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 9, 2023
Comment on lines -288 to +292
if err := errors.Wrap(gdb.Where(&db.Result{Parent: parent, Name: name}).First(r).Error); err != nil {
return nil, status.Errorf(status.Code(err), "failed to query on database: %v", err)
q := gdb.
Where(&db.Result{Parent: parent, Name: name}).
First(r)
if err := errors.Wrap(q.Error); err != nil {
return nil, err
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have a means of unit testing this error message?

Copy link
Contributor

Choose a reason for hiding this comment

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

@sayan-biswas bump on this question.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This errors are actually returned from the gorm package. In this repo we only have a wrapper. Untill we have a predefined set of error messages for all the RPCs, we can't create unit test to check the message string.

@tekton-robot tekton-robot added the do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. label Mar 19, 2023
Fix Issue tektoncd#337, error message for GetResult handler.
@sayan-biswas
Copy link
Contributor Author

/release-note-none

@tekton-robot tekton-robot added release-note-none Denotes a PR that doesnt merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Mar 19, 2023
@dibyom
Copy link
Member

dibyom commented Mar 20, 2023

@adambkaplan ok to merge?

@tekton-robot tekton-robot added release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed release-note-none Denotes a PR that doesnt merit a release note. labels Mar 24, 2023
Copy link
Contributor

@adambkaplan adambkaplan left a comment

Choose a reason for hiding this comment

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

/lgtm

Added a release note - bug fixes should have release notes.

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 24, 2023
@tekton-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adambkaplan, alan-ghelardi, avinal, khrm

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [adambkaplan,alan-ghelardi]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot merged commit ffe0be3 into tektoncd:main Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

List invalid results error message
7 participants