mirror of
https://github.com/crunchy-labs/crunchy-cli.git
synced 2026-01-21 04:02:00 -06:00
handle json unmarshall error
This commit is contained in:
parent
187a0c8817
commit
362708cf35
1 changed files with 3 additions and 1 deletions
|
|
@ -295,7 +295,9 @@ func (c *Crunchyroll) Search(query string, limit uint) (s []*Series, m []*Movie,
|
|||
defer resp.Body.Close()
|
||||
|
||||
var jsonBody map[string]interface{}
|
||||
json.NewDecoder(resp.Body).Decode(&jsonBody)
|
||||
if err = json.NewDecoder(resp.Body).Decode(&jsonBody); err != nil {
|
||||
return nil, nil, fmt.Errorf("failed to parse 'search' response: %w", err)
|
||||
}
|
||||
|
||||
for _, item := range jsonBody["items"].([]interface{}) {
|
||||
item := item.(map[string]interface{})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue