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

MG-2117 - Remove repository errors from API layer #2119

Merged
merged 8 commits into from
May 10, 2024

Conversation

WashingtonKK
Copy link
Contributor

@WashingtonKK WashingtonKK commented Mar 19, 2024

What type of PR is this?

This is a feature that removes removes repository errors from the api response and only the service error and api errors are sent as part of the response. All errors are logged and can be evaluated from the service logs.

What does this do?

Ensures only errors from the service and api are sent as part of the API response, and leaves repo errors at service level.

Which issue(s) does this PR fix/relate to?

Have you included tests for your changes?

No

Did you document any new/modified feature?

No

Notes

@WashingtonKK WashingtonKK marked this pull request as ready for review March 22, 2024 08:44
@WashingtonKK WashingtonKK requested a review from arvindh123 March 22, 2024 08:44
@arvindh123 arvindh123 added this to the S1 milestone Mar 25, 2024
@WashingtonKK WashingtonKK force-pushed the repo-err-fix branch 2 times, most recently from 33bd7ef to 5916549 Compare March 25, 2024 14:55
@WashingtonKK WashingtonKK linked an issue Mar 26, 2024 that may be closed by this pull request
@dborovcanin dborovcanin changed the title MG-2117 - Remove repo error in API response MG-2117 - Remove repository errors from API layer Mar 26, 2024
@arvindh123
Copy link
Contributor

@WashingtonKK

In users/service.go repoerr are returned by service function ,
Could you please change to respective service error and handle them as you did for other service

@dborovcanin dborovcanin modified the milestones: S1, S2 Apr 3, 2024
@WashingtonKK WashingtonKK force-pushed the repo-err-fix branch 3 times, most recently from 5ca3fe8 to 0074cc3 Compare April 9, 2024 06:59
@WashingtonKK WashingtonKK force-pushed the repo-err-fix branch 2 times, most recently from 1712df9 to 013b104 Compare April 26, 2024 07:23
Copy link
Contributor

@arvindh123 arvindh123 left a comment

Choose a reason for hiding this comment

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

@WashingtonKK ,
Please revert back to original, My suggestion doesn't works properly for domain related operations
It fails at domain authroization

@@ -231,9 +248,15 @@ func TestIssue(t *testing.T) {
ObjectType: auth.DomainType,
Permission: auth.MembershipPermission,
},
checkPolicyRequest2: auth.PolicyReq{
Copy link
Collaborator

Choose a reason for hiding this comment

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

Rename checkPolicyRequest fields to add more context. For example checkPolicyReq and checkPolicyWithStatusReq.

arvindh123
arvindh123 previously approved these changes Apr 30, 2024
Copy link
Contributor

@arvindh123 arvindh123 left a comment

Choose a reason for hiding this comment

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

LGTM

Signed-off-by: WashingtonKK <[email protected]>

Remove repoerr from things service

Signed-off-by: WashingtonKK <[email protected]>

Remove repoerr in services

Signed-off-by: WashingtonKK <[email protected]>

Fix ci

Signed-off-by: WashingtonKK <[email protected]>

Add servive error check

Signed-off-by: WashingtonKK <[email protected]>

Wrap permission list error

Signed-off-by: WashingtonKK <[email protected]>

Wrap permission list error

Signed-off-by: WashingtonKK <[email protected]>

Modify tests and keep internal errors

Signed-off-by: WashingtonKK <[email protected]>

Fix tests

Signed-off-by: WashingtonKK <[email protected]>

fix: enhance error encoding

Signed-off-by: WashingtonKK <[email protected]>

fix: update api docs

Signed-off-by: WashingtonKK <[email protected]>

feat: update checkdomain and checkpolicy

Signed-off-by: WashingtonKK <[email protected]>

fix: errors on service layer

Signed-off-by: WashingtonKK <[email protected]>

fix: tests

Signed-off-by: WashingtonKK <[email protected]>

fix: tests

Signed-off-by: WashingtonKK <[email protected]>

update tests

Signed-off-by: WashingtonKK <[email protected]>

fix: property based tests

Signed-off-by: WashingtonKK <[email protected]>

Remove repo error from service layer

Signed-off-by: WashingtonKK <[email protected]>

fix test'

Signed-off-by: WashingtonKK <[email protected]>

refactor errors:

Signed-off-by: WashingtonKK <[email protected]>

fix: property based tests

Signed-off-by: WashingtonKK <[email protected]>

fix: ci

Signed-off-by: WashingtonKK <[email protected]>

fix ci

Signed-off-by: WashingtonKK <[email protected]>

enhance errors

Signed-off-by: WashingtonKK <[email protected]>

fix: tests

Signed-off-by: WashingtonKK <[email protected]>

remove unused error

Signed-off-by: WashingtonKK <[email protected]>

update bootstrap and certs tests

Signed-off-by: WashingtonKK <[email protected]>

fix ci

Signed-off-by: WashingtonKK <[email protected]>

Update docs

Signed-off-by: WashingtonKK <[email protected]>

update bootstrap test

Signed-off-by: WashingtonKK <[email protected]>

fix auth tests

Signed-off-by: WashingtonKK <[email protected]>

fix typo:

Signed-off-by: WashingtonKK <[email protected]>

fix ci

Signed-off-by: WashingtonKK <[email protected]>
Signed-off-by: WashingtonKK <[email protected]>

refactor errors

Signed-off-by: WashingtonKK <[email protected]>

refactor errors

Signed-off-by: WashingtonKK <[email protected]>
Signed-off-by: WashingtonKK <[email protected]>

fix: certs and twins tests

Signed-off-by: WashingtonKK <[email protected]>
Signed-off-by: WashingtonKK <[email protected]>

fix: issue token

Signed-off-by: WashingtonKK <[email protected]>

refactor error handling and fix tests:

Signed-off-by: WashingtonKK <[email protected]>

fix tests and remove redundant error

Signed-off-by: WashingtonKK <[email protected]>

Update users/service.go

Co-authored-by: Arvindh <[email protected]>
Signed-off-by: WashingtonKK <[email protected]>

modify delete policies error

Signed-off-by: WashingtonKK <[email protected]>

revert error types

Signed-off-by: WashingtonKK <[email protected]>

fix: ci

Signed-off-by: WashingtonKK <[email protected]>

revert policy rollback error

Signed-off-by: WashingtonKK <[email protected]>

revert domain check

Signed-off-by: WashingtonKK <[email protected]>

remove debug logs

Signed-off-by: WashingtonKK <[email protected]>

fix bootstrap property based tests

Signed-off-by: WashingtonKK <[email protected]>

refactor bootstrap service error

Signed-off-by: WashingtonKK <[email protected]>
Signed-off-by: WashingtonKK <[email protected]>
Signed-off-by: WashingtonKK <[email protected]>
Signed-off-by: WashingtonKK <[email protected]>
Signed-off-by: WashingtonKK <[email protected]>
@dborovcanin dborovcanin merged commit 75db28c into absmach:main May 10, 2024
6 checks passed
@WashingtonKK WashingtonKK deleted the repo-err-fix branch May 10, 2024 13:27
JeffMboya pushed a commit to JeffMboya/supermq that referenced this pull request May 15, 2024
JeffMboya pushed a commit to JeffMboya/supermq that referenced this pull request May 15, 2024
andychao217 pushed a commit to andychao217/magistrala that referenced this pull request Sep 23, 2024
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.

Feature: Remove repository error in API response Refactoring Error Handling & Return Varaibles
4 participants