Publish Claude Code Binaries / Stage and publish binaries (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-arm64 (push) Canceled after 0s
Publish Tutti App Runtime / Build darwin-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build linux-amd64 (push) Canceled after 0s
Publish Tutti App Runtime / Build windows-amd64 (push) Canceled after 0s
Sync Tutti Agent Skills / sync (push) Canceled after 0s
Windows Agent Adapters / Test Windows agent adapters (push) Canceled after 0s
Windows Daemon Adapters / Test Windows daemon adapters (push) Canceled after 0s
Publish Tutti App Runtime / Publish runtime catalog (push) Canceled after 0s
42 lines
1.0 KiB
Go
42 lines
1.0 KiB
Go
package deviceauthority
|
|
|
|
import (
|
|
"fmt"
|
|
"net/http"
|
|
"strings"
|
|
)
|
|
|
|
const maxHTTPErrorBodyBytes = 4096
|
|
|
|
// HTTPError preserves bounded control-plane status metadata for adapter-owned
|
|
// retry policy. Callers should avoid logging Body because upstream responses
|
|
// are product data and may contain sensitive details.
|
|
type HTTPError struct {
|
|
StatusCode int
|
|
Body string
|
|
RetryAfter string
|
|
}
|
|
|
|
func (e *HTTPError) Error() string {
|
|
return fmt.Sprintf("control-plane request failed (%d)", e.StatusCode)
|
|
}
|
|
|
|
func (e *HTTPError) HTTPStatusCode() int { return e.StatusCode }
|
|
|
|
func (e *HTTPError) HTTPRetryAfter() string { return e.RetryAfter }
|
|
|
|
func newHTTPError(statusCode int, body []byte, retryAfter string) *HTTPError {
|
|
if len(body) > maxHTTPErrorBodyBytes {
|
|
body = body[:maxHTTPErrorBodyBytes]
|
|
}
|
|
message := strings.TrimSpace(string(body))
|
|
if message == "" {
|
|
message = http.StatusText(statusCode)
|
|
}
|
|
return &HTTPError{
|
|
StatusCode: statusCode,
|
|
Body: message,
|
|
RetryAfter: strings.TrimSpace(retryAfter),
|
|
}
|
|
}
|