Skip to content

tp: export ErrMissingUserURLCallback - #47

Merged
dangra merged 1 commit into
mainfrom
discharge-poll-deadline
Aug 24, 2026
Merged

dangra merged 1 commit into
mainfrom
discharge-poll-deadline

Conversation

@dangra

@dangra dangra commented Aug 24, 2026

Copy link
Copy Markdown
Member

Turns the "missing user-url callback" error into an exported sentinel so callers can recognise it with errors.Is instead of matching on its message.

Context

A client built without WithUserURLCallback cannot complete a discharge that the third party wants to hand to the user's browser, and doUserInteractive says so. That is a useful signal rather than a dead end: a caller that can open a browser but would rather not pay for the sequential, one-at-a-time flow can run the parallel pass first, see this error, and retry with a callback attached. flyctl does exactly that.

Until now the only way to recognise it was strings.Contains(err.Error(), "missing user-url callback"), against an inline errors.New that nothing promised to keep stable. Rewording it here would silently switch that caller off: no browser, no interactive discharge, and a debug log as the only trace.

Details

The message is unchanged, so existing string matching keeps working and this is safe to take on its own schedule. FetchDischargeTokens joins the per-ticket errors, and errors.Is sees through errors.Join, so a caller can test the error for a whole set of tickets. The new test in tp_test.go asserts that.

A client with no WithUserURLCallback cannot finish a discharge that the
third party wants to hand to the user's browser, and callers that can
supply one want to retry when they see it. The error carrying that was an
inline errors.New, so the only way to recognise it was to match on its
message, which is not something a caller should have to depend on.

Export it as a sentinel. The message is unchanged, so existing string
matching keeps working, and errors.Is sees through the joined error that
FetchDischargeTokens returns for a set of tickets.
Copilot AI lite review requested due to automatic review settings August 24, 2026 23:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@dangra
dangra merged commit 0f6cd2b into main Aug 24, 2026
1 check passed
@dangra
dangra deleted the discharge-poll-deadline branch August 24, 2026 23:19
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