enc := json.NewEncoder(w)
err := enc.Encode(struct {
Method string `json:"method"`
Results []interface{} `json:"results"`
CacheTime int `json:"cache_time"`
}{Method: answerInlineQueryMethod, Results: results, CacheTime: 0})
if err != nil {
log.Printf("failed to answer to inline query: %s", err)
}
How can I distinguish between JSON errors, which should cause a panic and errors caused by sending the response, which should be logged?