(payload map[string]any)
| 233 | } |
| 234 | |
| 235 | func decodeError(payload map[string]any) error { |
| 236 | if payload == nil { |
| 237 | return errors.New("wsrelay: unknown error") |
| 238 | } |
| 239 | message, _ := payload["error"].(string) |
| 240 | status := 0 |
| 241 | if v, ok := payload["status"].(float64); ok { |
| 242 | status = int(v) |
| 243 | } |
| 244 | if message == "" { |
| 245 | message = "wsrelay: upstream error" |
| 246 | } |
| 247 | return fmt.Errorf("%s (status=%d)", message, status) |
| 248 | } |