Something went wrong. Try again.
A command-line interface for tangled, the decentralized Git collaboration platform built on the AT Protocol. eric-wien.tngl.io/tng-cli
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051package api
import ( "fmt" "time")
// APIError represents an error response from the Tangled XRPC API.type APIError struct { StatusCode int ErrorType string `json:"error"` Message string `json:"message"` NSID string `json:"-"` // the procedure that failed}
func (e *APIError) Error() string { if e.Message != "" { return fmt.Sprintf("%s: %s (HTTP %d)", e.ErrorType, e.Message, e.StatusCode) } return fmt.Sprintf("%s (HTTP %d)", e.ErrorType, e.StatusCode)}
// IsNotFound returns true if this is a 404 error.func (e *APIError) IsNotFound() bool { return e.StatusCode == 404}
// IsForbidden returns true if this is a 403 error.func (e *APIError) IsForbidden() bool { return e.StatusCode == 403}
// IsUnauthorized returns true if this is a 401 error.func (e *APIError) IsUnauthorized() bool { return e.StatusCode == 401}
// RateLimitError indicates the API rate limit has been exceeded.type RateLimitError struct { RetryAfter time.Duration Inner *APIError}
func (e *RateLimitError) Error() string { return fmt.Sprintf("rate limited: retry after %s", e.RetryAfter)}
func (e *RateLimitError) Unwrap() error { return e.Inner}