code: func WriteError(w http.ResponseWriter, err error) {
  	if IsAggregate(err) {
  		for i := 0; i < maxHops; i++ {
  			var aggErr Aggregate
  			var ok bool
  			if aggErr, ok = Unwrap(err).(Aggregate); !ok {
  				break
  			}
  			errors := aggErr.Errors()
  			if len(errors) == 0 {
  				break
  			}
  			err = errors[0]
  		}
  	}
  	replyJSON(w, ErrorToCode(err), err)
  }
docs: // WriteError sets up HTTP error response and writes it to writer w