Skip to content

Commit

Permalink
Better handling of unexpected results from Raindrop
Browse files Browse the repository at this point in the history
  • Loading branch information
westerlind committed Nov 27, 2021
1 parent c5fe14a commit fc58837
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions raindrop_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,11 @@ func search_request(query string, token RaindropToken, collection int, tag strin

json.Unmarshal(response_body, &result)

result_items := result["items"].([]interface{})
if result_items == nil {
var result_items []interface{}
if result["items"] != nil && len(result["items"].([]interface{})) > 0 {
result_items = result["items"].([]interface{})
} else {
fmt.Println("\n/**** Unexpected response from server ****\n" + string(response_body) + "\n***********************************/\n")
var nothing []interface{}
err = errors.New("Could not get results")
return nothing, err
Expand Down

0 comments on commit fc58837

Please sign in to comment.