You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
cli: apply review feedback to broker dial error classification
- Demote ErrBrokerClosed to unexported errBrokerClosed: the SDK flattens
dial errors into text, so error identity never survives end-to-end and
an exported sentinel has no consumer. Classification rides the
user-visible message; only in-module tests use errors.Is.
- Drop the "flashduty: " prefix from the new messages (the SDK adds it),
and give the 0xFF refusal its final actionable wording.
- Fix "broker parse rights: %w" rendering %!w(<nil>) when the rights
parse succeeds but yields no fd.
- Reword comments to state production errno behavior (Linux SEQPACKET
send -> EPIPE; datagram-style peer death -> ECONNREFUSED) and note the
sentinel covers the handshake phase only.
Copy file name to clipboardExpand all lines: internal/cli/broker_dial_unix.go
+24-14Lines changed: 24 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -19,14 +19,21 @@ import (
19
19
// never returns nil), but defaultNewClient references it on every platform.
20
20
varerrBrokerUnsupported=errors.New("flashduty: broker mode is not supported on this platform")
21
21
22
-
// ErrBrokerClosed is returned (wrapped) when the runner-side broker control
22
+
// errBrokerClosed is returned (wrapped) when the runner-side broker control
23
23
// channel is gone: the runner exited, or reclaimed the channel once the
24
24
// command that started this process finished, so fduty calls from a
25
25
// long-lived background process fail this way. A live broker declining a
26
-
// dial is a different failure (see the 0xFF path in dial). Callers and
27
-
// automation can tell the two apart with errors.Is(err, ErrBrokerClosed);
28
-
// the wrapping by http.Transport and url.Error preserves that.
29
-
varErrBrokerClosed=errors.New("flashduty: broker control channel closed: the broker that started this process is no longer available")
26
+
// dial is a different failure (see the 0xFF path in dial).
27
+
//
28
+
// The distinction rides the user-visible message, not error identity: the
29
+
// SDK flattens dial errors into text ("%v"), so only in-module tests
30
+
// classify via errors.Is; humans and agents reading the output tell the two
31
+
// failures apart by wording.
32
+
//
33
+
// It covers the handshake phase only. When an already-dispatched connection
34
+
// is torn down, in-flight requests see EOF/reset first; the next dial
35
+
// reports this error.
36
+
varerrBrokerClosed=errors.New("broker channel closed: the command that started this process has finished — rerun it in the foreground of a live session")
30
37
31
38
// brokerEgressCapable reports whether this build can act as a broker-mode client
32
39
// (read FLASHDUTY_CRED_FD and dial over the inherited control fd). The runner
0 commit comments