code: func encodeResponseErr(w http.ResponseWriter, err interface{}) {
  	enc := json.NewEncoder(w)
  
  	rErr, ok := err.(*apitypes.Error)
  	if ok {
  		w.WriteHeader(rErr.StatusCode())
  		enc.Encode(rErr)
  	} else {
  		w.WriteHeader(http.StatusInternalServerError)
  		enc.Encode(&errorMsg{
  			Type:  apitypes.InternalServerError,
  			Error: []string{"Internal server error"},
  		})
  	}
  }
docs: // if encoding has errored, our struct is either bad, or our writer
  // is broken. Try writing an error back to the client, but ignore any
  // problems (ie the writer is broken).