-
Notifications
You must be signed in to change notification settings - Fork 1
Error Handling
福狼 edited this page May 13, 2026
·
1 revision
steam-go uses *steam.APIError to classify SDK errors.
The goal is to make failures easy to inspect without parsing error strings.
| Kind | Meaning |
|---|---|
request_build |
Failed to build request |
transport |
Network or transport failure |
http_status |
Non-success HTTP status |
decode |
Failed to decode response |
api_response |
Steam API returned an application-level error |
var apiErr *steam.APIError
if errors.As(err, &apiErr) {
fmt.Println(apiErr.Kind)
fmt.Println(apiErr.StatusCode)
fmt.Println(apiErr.BodyPreview)
}Useful fields:
- error kind
- HTTP status code
- request method
- redacted URL
- short body preview
- retry count if available
- traffic class if available
Avoid logging:
- raw API key
- raw access token
- full request URL before redaction
- full response body when it may contain sensitive or huge content
safeURL := steam.RedactSensitiveURL(rawURL)| Error Kind | Suggested Response |
|---|---|
request_build |
Fix caller input or SDK bug |
transport |
Retry if safe |
http_status |
Check status, rate limit, auth, or block |
decode |
Inspect raw response or update model |
api_response |
Handle Steam-level error semantics |
____ ____ ____ _ _ ____ ____ _ _ / ____ ___ ____ ____ _ _ ____ ____
| __ | | |___ | | |__/ |__/ \_/ / [__ | |___ |__| |\/| __ | __ | |
|__] |__| | |__| | \ | \ | / ___] | |___ | | | | |__] |__|
- SteamID Model
- Steam Web API Notes
- Public Store Page Access Notes
- Partner API Notes
- OpenID Notes
- A2S Notes
- Steam Keys and Access Tokens
- Steam Static Assets
- Steam VDF and addons/vdf
- Steam Web API 特性说明
- 公开商店页面访问说明
- Partner API 说明
- OpenID 说明
- A2S 说明
- Steam Key 与 Access Token
- Steam 静态资源
- Steam VDF 与 addons/vdf