Skip to content

migrate controller to core/errors TangoError#173

Open
justinwon777 wants to merge 3 commits into
mainfrom
common-migrate
Open

migrate controller to core/errors TangoError#173
justinwon777 wants to merge 3 commits into
mainfrom
common-migrate

Conversation

@justinwon777

@justinwon777 justinwon777 commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

This removes all usages of core/common errors in controller and classifies user failures with TangoError.
GetChangedTargets and GetTargetGraph return error with mapper.ToProtoError(retErr) so all errors are classified.

Test Plan

unit tests

@justinwon777 justinwon777 requested review from a team as code owners July 10, 2026 08:46
@justinwon777 justinwon777 marked this pull request as draft July 10, 2026 08:49
@justinwon777 justinwon777 changed the title [WIP] refactor: migrate controller and orchestrator to core/errors TangoError [WIP] migrate controller and orchestrator to core/errors TangoError Jul 10, 2026
@justinwon777 justinwon777 changed the title [WIP] migrate controller and orchestrator to core/errors TangoError [WIP] migrate controller to core/errors TangoError Jul 11, 2026
@justinwon777 justinwon777 changed the title [WIP] migrate controller to core/errors TangoError migrate controller to core/errors TangoError Jul 13, 2026
@justinwon777 justinwon777 marked this pull request as ready for review July 13, 2026 17:36
@justinwon777 justinwon777 force-pushed the justin.won/errors branch 3 times, most recently from a30bd54 to 1a48b38 Compare July 14, 2026 19:20
@justinwon777 justinwon777 marked this pull request as draft July 15, 2026 01:29
@justinwon777 justinwon777 force-pushed the justin.won/errors branch 3 times, most recently from 4149fe6 to 331adab Compare July 15, 2026 23:29
Base automatically changed from justin.won/errors to main July 16, 2026 08:22
justinwon777 and others added 2 commits July 16, 2026 01:48
No functional changes; goimports reorders tangopb/tango.pb.go's import
grouping. gazelle and gofmt reported nothing to change.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@justinwon777 justinwon777 force-pushed the common-migrate branch 4 times, most recently from 6ef5b89 to 09379b9 Compare July 16, 2026 09:15
@justinwon777 justinwon777 marked this pull request as ready for review July 16, 2026 09:19
Comment thread controller/gettargetgraph.go Outdated
Comment thread controller/gettargetgraph.go Outdated
Comment thread controller/gettargetgraph.go Outdated
Add a mapper package to convert core/errors.TangoError into the
proto TangoError message returned by RPCs.
require.True(t, errors.As(err, &ce))
assert.Equal(t, common.FailureReasonCancelled, ce.Reason())
assert.Equal(t, common.ErrorTypeUser, ce.Type())
assert.Contains(t, err.Error(), "context canceled")

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.

Nit: don't assert on error string

if err != nil {
if ctx.Err() != nil {
return nil, common.WithReason(common.FailureReasonCancelled, common.ErrorTypeUser, ctx.Err())
return nil, ctx.Err()

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.

Should we wrap the context cancelled errors too so we know where it came from?

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