Skip to content

refactor: api error handling in Team and CodeRef packages - #2109

Merged
kakcy merged 8 commits into
mainfrom
refactor-error-handle-coderef
Sep 30, 2025
Merged

refactor: api error handling in Team and CodeRef packages#2109
kakcy merged 8 commits into
mainfrom
refactor-error-handle-coderef

Conversation

@kakcy

@kakcy kakcy commented Sep 4, 2025

Copy link
Copy Markdown
Contributor

This pull request refactors error handling and status construction throughout the coderef and team services to use a standardized error package. This improves consistency, maintainability, and clarity of gRPC error responses, while also removing legacy error definitions. The changes affect API service files, domain error definitions, and storage error handling.

I have also standardized the process of assigning ErrorInfo to GRPCStatus for each error via api.NewGRPCStatus.
This ErrorInfo will be used when moving i18n to the frontend(#1253), and we plan to generate error messages etc. based on this information on the frontend.

@kakcy kakcy changed the title refactor: API-related error handling in Team and CodeRef packages refactor: api error handling in Team and CodeRef packages Sep 4, 2025
Comment thread pkg/coderef/storage/code_reference.go Outdated
"fmt"

"github.com/bucketeer-io/bucketeer/pkg/coderef/domain"
err "github.com/bucketeer-io/bucketeer/pkg/error"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We usually use "err" for error variable, so for package name, can we use err2 or error2/errors2 ... ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your suggestion.
Renaming a package is expensive, so how about modifying it to bkterr "github.com/bucketeer-io/bucketeer/pkg/error"?
bkt is the prefix for Bucketeer.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@hvn2k1
I changed bkterr.
4a644cf

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@hvn2k1
Regarding this matter, how about the following solution?
4a644cf
Please check it when you have time.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Sorry for the late reply 🙇🏻 , the bkterr lgtm

# Conflicts:
#	pkg/coderef/api/api.go
#	pkg/coderef/api/code_reference.go
#	pkg/coderef/storage/code_reference.go
#	pkg/team/api/api.go
#	pkg/team/storage/team.go

@hvn2k1 hvn2k1 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thank you!

@kakcy
kakcy merged commit 4828e66 into main Sep 30, 2025
11 checks passed
@kakcy
kakcy deleted the refactor-error-handle-coderef branch September 30, 2025 01:54
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.

2 participants