Skip to content

refactor: api error handling in AuditLog and AutoOps packages - #2116

Merged
kakcy merged 9 commits into
mainfrom
refactor-error-handle-auditlog
Sep 17, 2025
Merged

refactor: api error handling in AuditLog and AutoOps packages#2116
kakcy merged 9 commits into
mainfrom
refactor-error-handle-auditlog

Conversation

@kakcy

@kakcy kakcy commented Sep 9, 2025

Copy link
Copy Markdown
Contributor

This pull request refactors error handling across the audit log and auto ops services to use a centralized error and gRPC status construction mechanism. The changes improve consistency, maintainability, and extensibility of error handling, and introduce support for additional gRPC error codes.

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 marked this pull request as draft September 10, 2025 01:29
@kakcy
kakcy marked this pull request as ready for review September 10, 2025 06:48
Comment thread pkg/autoops/api/api_test.go Outdated
s.experimentClient.(*experimentclientmock.MockClient).EXPECT().GetGoal(
gomock.Any(), gomock.Any(),
).Return(nil, errors.New("error"))
).Return(nil, err.NewErrorInternal("autoops", "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.

It'd be better to use pkgErr.AutoopsPackageName.

@kakcy

kakcy commented Sep 12, 2025

Copy link
Copy Markdown
Contributor Author

@nnnkkk7
The package name has been modified to use a constant definition.
ea34af8

@nnnkkk7 nnnkkk7 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.

Thanks!
LGTM!

@kakcy
kakcy merged commit 6142fa4 into main Sep 17, 2025
11 checks passed
@kakcy
kakcy deleted the refactor-error-handle-auditlog branch September 17, 2025 06:15
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