fish2018/pansou · error

[quarkres] API error

Error message

[quarkres] API error: %s

What it means

API-level error in quarkres' doSearch (plugin/quarkres/quarkres.go:114): the JSON decoded but the API's Code field is not 200; its Message text is embedded in the error. A well-formed response reporting a query failure.

Solutions

  1. 按 Message 区分处理:修正输入或降频
  2. 监控该错误发现 API 协议变更
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at plugin/quarkres/quarkres.go:114 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07). Data as JSON: /api/errors/466fea3a593c9df3. Report an issue: GitHub.

Appendix: source

Thrown at plugin/quarkres/quarkres.go:114

	}
	defer resp.Body.Close()

	if resp.StatusCode != 200 {
		return nil, fmt.Errorf("[quarkres] HTTP %d", resp.StatusCode)
	}

	bodyBytes, err := io.ReadAll(resp.Body)
	if err != nil {
		return nil, fmt.Errorf("[quarkres] read response failed: %w", err)
	}

	var ar apiResp
	if err := json.Unmarshal(bodyBytes, &ar); err != nil {
		return nil, fmt.Errorf("[quarkres] decode response failed: %w", err)
	}

	if ar.Code != 200 {
		return nil, fmt.Errorf("[quarkres] API error: %s", ar.Message)
	}

	results := make([]model.SearchResult, 0, len(ar.Data))
	for _, item := range ar.Data {
		links := make([]model.Link, 0, len(item.Links))
		for _, l := range item.Links {
			// 只保留夸克链接(本源只有夸克)
			if strings.Contains(l.URL, "pan.quark.cn") {
				links = append(links, model.Link{
					Type:     "quark",
					URL:      l.URL,
					Password: l.Password,
					Datetime: item.Datetime,
				})
			}
		}
		if len(links) == 0 {
			continue

View on GitHub (pinned to beaa561337)